I open for some correction of my understanding of this, but I am not sure why this happens.
When using git, I understand that if I make a change to a file and then commit it I get a new hash because the file has changed.
My understanding of git commit --amend
is that I can make changes to the last commit.
Now I can understand that if I change the commit message, the hash will change.
But when I do not make any changes and just save and exit out of the editor (I may have changed my mind on needing a change) why does the hash change?
All my files and everything is the same, but I have saved it. When I of a git log
the time of the commit hasn't changed, it just appears twice in the log with the same time, the same message, same files except a different commit hash.
Why does it change if no alterations have been done??