Why does git commit --amend change the hash even if I don't make any changes?
问题 Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running git commit --amend ? Say I run the following at the command line. cd ~/Desktop mkdir test_amend cd test_amend git init echo 'foo' > test.txt git add test.txt git commit -m 'initial commit' Then, invoking git log --pretty=oneline --abbrev-commit prints the following message: b96a901 initial commit I then do git commit --amend but I change my mind and decide not to