Re: fsck missing dangling commits that are candidate heads?
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 3, 2007, 19:47 UTC
- Message-ID
- <20070403194750.GG27706@spearce.org>
- In-Reply-To
- <loom.20070403T213135-68@post.gmane.org>
Sergio Callegari <scallegari@arces.unibo.it> wrote:
Show 14 quoted lines
> on git 1.5.0.6, I have done the following: > git commit -a > git reset HEAD^ (assume a mistake) > git fsck > > the last fsck shows nothing... > Is this correct? Shouldn't the latest commit (the one made unreachable by the > reset) be reported as dangling and as a candidate branch head? > > Also git lost-found misses the commit... > But it is there... I can find it manually in the object database and tag it. > > Also git gc --prune seems to miss the commit... so when we gc useless objects > appear to be kept around.
Right. This is the reflog in action. Your current branch has two reflogs, .git/logs/HEAD and .git/logs/refs/heads/$foo, where $foo is your current branch name. Both of these logs mention the commit you are looking for, so they aren't considered dangling garbage, nor are they pruneable.
Use `git log -g` or `git log -g $foo` to look at the reflog for HEAD and $foo to locate the commit in question.
-- Shawn.