user4127551
user4127551

Reputation: 25

why SHA changed but commit message stays the same

I'm exploring git and did something that results in a strange behavior. As git log shows below, the 2nd commit's SHA hash has changed but the message stays the same. Could someone please point out to me how to find the differences between the 2nd commit of yesterday and today? Thank you

TODAY:
* 09ed1fc (HEAD -> master) third commit
* 0d7f23f second commit
* c02a2ea first commit 

YESTERDAY:
* 8e5cf1e second commit
* c02a2ea first commit

What puzzles me is that the 2 different commits for the 2nd commit (8e5cf1e and 0d7f23f) were created at the same time:

>git log -1 8e5cf1e
commit 8e5cf1ea4fae4a9568b5e8c1622b63efd0e5b27f
Author: Me
Date:   Sun Dec 3 11:30:40 2017 -0500

    second commit

>git log -1 0d7f23f
commit 0d7f23fb8dd1db6728579eae0c8c272a17b6ad40
Author: Me
Date:   Sun Dec 3 11:30:40 2017 -0500

    second commit

Upvotes: 1

Views: 43

Answers (1)

Allen Luce
Allen Luce

Reputation: 8389

You should be able to do a git diff 0d7f23f 8e5cf1e to see the changes. The SHA may have changed due to a rebase, an amended commit, or a few other reasons.

Upvotes: 1

Related Questions