4 ms·
git forgets nothing. A branch is just a reference to a commit, that reference goes nowhere unless you delete it
by cerved 5y ago
git forgets nothing. A branch is just a reference to a commit, that reference goes nowhere unless you delete it
- ghoward 5y agoNot GP. I may be wrong here, but I would argue that git does forget something: it forgets where the branch reference used to point when a new commit is made on that branch. If a commit has more than one parent, that means some information is lost because it has to guess which parent the branch reference came from.
- astrange 5y agoThat info is in the reflog, but it will be GCd eventually.
- cerved 5y agoafaik, only merge commits have two parents. Then the source branch would still point to the head of that branch. Furthermore, without having checked, aren't merge commits deterministic in the order of references? I wouldn't be surprised if this information isn't trivially available in a porcelain command but more surprised if it's lost
- ghoward 5y agoIf a branch is just a reference, then how that reference changes over time will be lost. As astrange says, that info will be in the reflog, but the reflog is subject to GC. Once a GC happens, that info is forgotten.