为何 git commit 之后再执行 git diff --cached 仍然显示有不同?
ringa_lee
ringa_lee 2017-04-24 09:10:55
0
2
961

请问为什么我执行git commit之后再执行git diff --cached仍然显示有不同?

我的理解是git commit把暂存区域的内容提交到本地库,这样的话​git diff --cached就不会显示任何内容啊.

请问我的理解哪里出了问题,先谢谢了!

ringa_lee
ringa_lee

ringa_lee

reply all(2)
伊谢尔伦

Sorry for not describing the steps in detail. I originally thought there was a problem with my understanding of these two commands, so I only wrote these two steps. The problem lies in the description information that needs to be filled in when git commit. I skipped it directly in vim: wq, and no commit was successful. Output

Aborting commit due to empty commit message

I didn’t see this message at the time When committing, just be careful not to leave the commit empty

黄舟

git diff --cached #View cached changes

The git diff --cached command will tell you what content has been written to the cache. That is, this command shows what will be written to the snapshot next.

git diff HEAD View all cached and uncached changes

If you want to view cached and uncached changes together, you can execute git diff HEAD - that is to say, what you want to see is the difference between the working directory and the last submitted update, ignoring the cache

I have included a concise reference manual for git in my personal blog. This manual is enough to handle the git commands used in daily work. If you are interested, you can read it and check it out at any time: A concise reference manual for git

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template