git notes main page | gitolite main page | license
IMPORTANT NOTE:
although this page has a "gitolite.com" URL, this is not about gitolite.
That's just an artifact of "sitaramc.github.com" being translated to
"gitolite.com" and so ALL my git related stuff gets carried over.
Gitolite documentation has another /gitolite
in the URL, so
you can tell. My apologies for this confusion.
a reflog is a very special “branch” that records each position of HEAD in the last 30 days (by default). So removed branches won’t be purged by prune until after waiting for 30 days, when the last reference to them will finally be released.
reflog history is not shared – it is exclusive to your repository. This is the only thing you lose if you clone a project as a means of performing a backup.
the basic reflog commands are like this (the relative date is my preference; see git help log
for other choices)
# activity on HEAD, including timestamp
git reflog show --date=relative
# same, on some_branch
git reflog show --date=relative some_branch
a good way to visualise the reflog is git show-branch -g
(or -gN
, where N is some integer). This shows reflog info for the branch specified (defaulting to the current branch), including topological relationships and relative time. This is useful if you had a lot of rebases or amended commits and you think you might need one of them back :-)
It takes a little getting used to, so here’re some hints:
you can recover commits made on a detached head
you can fix a non-bare push
Here’s a neat tool that shows you reflog output but using gitk – the graphical viewer. Don’t knock it until you’ve tried it :-)
[based on a comment in https://blogs.gnome.org/newren/2007/11/24/local-caching-a-major-distinguishing-difference-between-vcses/]