Re: [PATCH] logging branch deletion to help recovering from mistakes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 07, 2010 at 12:54:18PM -0500, Casey Dahlin wrote:

> On Tue, Dec 07, 2010 at 11:45:20AM -0600, Jonathan Nieder wrote:
> > Casey Dahlin wrote:
> > 
> > > Could commits made onto a detached head also show up here? Or is that
> > > better thwarted with another mechanism?
> > 
> > I think that's better thwarted with the HEAD reflog:
> > 
> > 	$ git log -g HEAD
> 
> I was more worried about changes that were made onto a detached head,
> and then the head was reattached, leaving the new commits dangling.
> 
> The end result is identical to a deleted branch, just wondering if we
> should note it in the same place.

We have enough information in the HEAD reflog already to reconstruct
those sorts of things.

You can detect entering and leaving the detached HEAD in the reflog. The
reflog comments look something like this:

  checkout: moving from $SOME_BRANCH to $SOME_SHA1
  commit: $SOME_COMMIT_MESSAGE
  checkout: moving from $SOME_OTHER_SHA1 to $BRANCH|$SHA1

So from that you can see that we entered a detached HEAD state, made a
commit, and that commit became dangling when we moved. One could write a
script to search for these cases (but note that most detached instances
just involve rebasing, which is probably not interesting, as we install
the result into the branch tip at the end).

I don't think this belongs in the same realm as "deleted branches", but
I do think we could have a special option to "git fsck" to stick these
into lost-found.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]