[Python-Dev] PEP 481 - Migrate Some Supporting Repositories to Git and Github
Donald Stufft
donald at stufft.io
Mon Dec 1 01:30:59 CET 2014
> On Nov 30, 2014, at 7:17 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
>
> Donald Stufft <donald at stufft.io> writes:
>
>> I have never heard of git losing history.
>
> In my experience talking with Git users about this problem, that depends
> on a very narrow definition of “losing history”.
>
> Git encourages re-writing, and thereby losing prior versions of, the
> history of a branch. The commit information remains, but the history of
> how they link together is lost. That is a loss of information, which is
> not the case in the absence of such history re-writing.
>
> Git users differ in whether they consider that information loss
> important; but it is, objectively, losing history information. So
> Ethan's impression is correct on this point.
>
It’s not lost, the only thing that’s “gone” is a pointer to the HEAD commit
of that branch. Each commit points to it’s parent commit so if you find the
HEAD and give it a name you’ll restore the branch. It just so happens inside
the reflog you’ll see a list of the old HEADs of branches so you can get the
old commit ID from the HEAD there. In addition depending on how you rewrote
the branch and if you did anything else there is likely a reference to the
old head at ORIG_HEAD. If you don’t have the reflog (this is per copy of the
repository, so a different computer or deleting the repo and recreating it
will lose it) and for similar reasons you don’t have the ORIG_HEAD, if you
have any reference to the previous HEAD (email, commit messages, whatever)
that’s enough to restore it assuming that the commits have not been garbage
collected yet (which happens in 90 days or 30 days depending on what kind of
unreferenced commit it is) you can restore it.
The important thing to realize is that a “branch” isn’t anything special in
git. All a branch does is act as a sort of symlink to a commit ID. Anything
more beyond “what is the HEAD commit in this branch” is stored as part
of the commits themselves and doesn’t rely on the branch to be named.
---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
More information about the Python-Dev
mailing list