2019-06-17 如何让工作区的文件恢复成和暂存区一样
作者:
张大志的博客 | 来源:发表于
2019-06-17 16:14 被阅读0次[root@VM_0_3_centos project]# vim index.html
index
[root@VM_0_3_centos project]# git add index.html #将修改的文件添加到暂存区
[root@VM_0_3_centos project]# vim index.html #再次修改工作区文件
index
123
[root@VM_0_3_centos project]# git diff index.html #发现工作区和暂存区不一样了
diff --git a/index.html b/index.html
index 9015a7a..8939b5d 100644
--- a/index.html
+++ b/index.html
@@ -1 +1,2 @@
index
+123
[root@VM_0_3_centos project]# git checkout index.html #将工作区文件恢复到暂存区
[root@VM_0_3_centos project]# git diff index.html #发现没有区别了
注意:如果要变工作区用checkout,改变暂存区用reset
本文标题:2019-06-17 如何让工作区的文件恢复成和暂存区一样
本文链接:https://www.haomeiwen.com/subject/cvzafctx.html
网友评论