Hacker News new | past | comments | ask | show | jobs | submit login

How do they know which branch in my fork is mine vs upstream? Or in the case where I modify a forked branch?



It's sort of the reverse: they can't know, from a bare commit ID, what repo it "belongs" to without searching backward from every tag or branch in the repo. (Even that question is malformed: repos have histories and may have contained commits in the past that are no longer ancestors of existing branches or tags).

So they just fake it: they look in their database to find any commit with that SHA and put it up. And that database happens (for obvious performance reasons) to be shared between a repo and its forks.


A branch is just a series of commits; if any one of the commits has a different hash (as this hack will do) then the commit and all following commits will have a different hash.

Including the id of the branch (the HEAD).


It's simpler than that: a branch is just a pointer to one specific commit (with a specific SHA)


True, but it's both.

Just as a link in a linked list is often the list and the node in the list.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: