您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
19 怎么比较暂存区和HEAD所含...
发布时间:2020-07-18 16:31:00编辑:雪饮阅读()
比较暂存区与head的区别,只需要使用diff命令的—cached参数即可
这里对1.txt进行了修改
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master)
$ cat 1.txt
1
并且重新git add到缓存区了
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master)
$ git add 1.txt
warning: LF will be replaced by CRLF in 1.txt.
The file will have its original line endings in your working directory
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master)
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: 1.txt
然后我们先不要急着提交,此时就可以对比暂存区和之前项目的区别了。
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master)
$ git diff --cached
diff --git a/1.txt b/1.txt
index e69de29..d00491f 100644
--- a/1.txt
+++ b/1.txt
@@ -0,0 +1 @@
+1
关键字词:git,比较暂存区,cached,head