[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 如何让工作区的文件恢复成和暂存区一样
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。