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
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
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
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