Do forks share the same sha for overlapping commits?


#1

I am trying to understand how forking exactly works. When repo A contains 10 commits and gets forked to repo B, suddenly repo B also counts 10 commits, but these commits are the same. My assumption is that the sha or oid for each commit is the same across both repos, is that correct? So, when I compare all commits on repo A with repo B I should be able to calculate an intersection and return % of overlap?

I’ve setup a test, but although both repos have been forked from the same parent, the commits don’t seem to overlap at all. So I’m either running into a technical/conceptual issue or my above assumption is not correct.


#2

They do overlap. The same commit has the same hash in all repos where it’s present.