Skip to content

Instantly share code, notes, and snippets.

@mulka
Created June 14, 2013 18:38
Show Gist options
  • Save mulka/5784212 to your computer and use it in GitHub Desktop.
Save mulka/5784212 to your computer and use it in GitHub Desktop.
identical git commits having different hashes?
This doesn't make any sense to me. I thought two identical diffs would have identical commit ids in git. But, this does not appear to be the case, as I have made two commits which are otherwise the same. I did this by rebasing two branches off the same branch. I feel like the intermediate commits should have been the same, but then I saw a fork in my tree. See below:
(venv)Kyle-Mulkas-MacBook-Pro:tchat.io mulka$ git show 6d5aaae49d6 > 1
(venv)Kyle-Mulkas-MacBook-Pro:tchat.io mulka$ git show 79a47534655 > 2
(venv)Kyle-Mulkas-MacBook-Pro:tchat.io mulka$ diff 1 2
1c1
< commit 6d5aaae49d66d9cfa95c5340ef8562f876694758
---
> commit 79a47534655e4afbfebbcb354adeb59943ca7edc
(venv)Kyle-Mulkas-MacBook-Pro:tchat.io mulka$
@jmathai
Copy link

jmathai commented Jun 14, 2013

Git rebase? I thought it changes the commit hash.

@jmathai
Copy link

jmathai commented Jun 14, 2013

@crebma
Copy link

crebma commented Jun 14, 2013

I do not know, but I'd assume it has to do with the commit time as part of the hash algorithm.

@crebma
Copy link

crebma commented Jun 14, 2013

Or maybe not the date, but I think the hash is a bunch of stuff, not just the text content, like branch hierarchy, etc.

@fbartho
Copy link

fbartho commented Jun 15, 2013

The date, and parent commit hashes are part of the hash of a particular commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment