8

I know this has been said to be pretty much statistically impossible but that's a different question. What would be the consequences if against all odds, this did occur?

2
  • 7
    I think stackoverflow.com/questions/9392365/… covers this pretty thoroughly.
    – Ixrec
    Commented Jul 24, 2015 at 21:58
  • 2
    The universe will end. Only joking. If it rely did happen. Then you would be rich and famous. You may even get some sort of prize. Commented Jul 24, 2015 at 22:15

1 Answer 1

7

If two files have the same hash, then git assumes they are the same file. For example if you change a file in such a way that the hash stays the same, git will not realise that the file has changed and "git status" will not report it. Now if you change a file twice, so that the hash changes from A to X and back to A, and you committed both changes, and I pull the repo while having the old file with hash A, then it's most likely that I won't get the change because git thinks I've got it already.

Of course with 160 bit hash, it's much more likely that one meteorite hits the server containing the master and destroys it with all backups, while another one hits you, destroys your computer and kills you just before you try to commit.

1
  • 3
    The question is asking about commit IDs, not file contents in your working directory. Commented Jan 27, 2020 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.