3 ms·
reflog is a pretty neat demonstration of the power inherent in the way git stores data. The backend is just a giant bucket of changesets, and then constructs li
by gxti 16y ago
reflog is a pretty neat demonstration of the power inherent in the way git stores data. The backend is just a giant bucket of changesets, and then constructs like branches and tags are pointers into that bucket. You get free undo because git keeps a list of what the HEAD of the branch was each time it changes, so you can rewind by moving the pointer back to where it was. Of course every time you rewrite history (like rebase does) that orphans a whole line of changesets which have been superseded by the newly rewritten ones, which is why you need to (or git needs to) "garbage collect" periodically. Once an orphaned line gets pushed off the end of the reflog, changesets only referenced by those old HEADs can be deleted.