git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] logging branch deletion to help recovering from mistakes
Date: Tue, 7 Dec 2010 14:38:05 -0500	[thread overview]
Message-ID: <20101207193804.GA27685@sigill.intra.peff.net> (raw)
In-Reply-To: <7v7hflqth1.fsf@alter.siamese.dyndns.org>

On Tue, Dec 07, 2010 at 11:21:46AM -0800, Junio C Hamano wrote:

> I am more worried about stuff in branch.<name>.* that are discarded upon
> "branch -d".  Without the config items, you won't have a working:
> 
>     $ branch -d frotz
>     $ branch --undelete frotz
>     $ git checkout frotz
>     $ git pull

Hmm, yeah, I didn't think about that. Two possible solutions:

  1. Just leave it in .git/config. It is not hurting anything if the
     branch does not exist, but it is cruft in a file the user might
     look at.

  2. Drop it into .git/config.dead/<branch_name>. When resurrecting a
     branch, copy it back into .git/config.

In both cases, when the reflog for the deleted branch is pruned to
nothing, we delete the relevant config, too.

In the second case, I think you would have to take special care for
something like:

  $ git branch frotz origin/master
  $ git branch -d frotz
  $ git remote rename origin foo
  $ git branch --undelete frotz

In the non-deleted case, this transparently renames branch.frotz.remote
from "origin" to "foo". In the deleted case, we would need to make sure
the dead config is updated, too.


To be honest, I have never been that interested in a "branch --undelete"
feature. I much more care about leaving the reflogs of deleted branches
around, so I can "git checkout -b foo bar@{1}" later on[1]. That is, to
me branch undeletion is not about bringing a branch back wholesale, but
rather remembering commits so I can start a new branch there.

But I guess others might disagree.

-Peff

[1] Well, that and just piece of mind from knowing that "branch -d" is
    not totally unrecoverable. Specifically, if we kept deleted reflogs
    around, it would be safe(r) to turn on auto-prune on fetch, the lack
    of which is something that seems to confuse new users.

  reply	other threads:[~2010-12-07 19:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 21:16 [PATCH] logging branch deletion to help recovering from mistakes Junio C Hamano
2010-12-06 21:55 ` Štěpán Němec
2010-12-06 23:14 ` Andreas Schwab
2010-12-07  1:18 ` Nguyen Thai Ngoc Duy
2010-12-07  6:28   ` Junio C Hamano
2010-12-07 11:37     ` Nguyen Thai Ngoc Duy
2010-12-07 15:25       ` Michael J Gruber
2010-12-07 16:25         ` Nguyen Thai Ngoc Duy
2010-12-07 16:22       ` Jakub Narebski
2010-12-07 16:26         ` Nguyen Thai Ngoc Duy
2010-12-07 17:06     ` Jeff King
2010-12-07 18:14       ` Shawn Pearce
2010-12-07 18:20         ` Jeff King
2010-12-07 18:23           ` Shawn O. Pearce
2010-12-07 18:35             ` Jeff King
2010-12-07 18:37               ` Shawn O. Pearce
2010-12-07 18:39                 ` Jeff King
2010-12-07 18:41                   ` Shawn O. Pearce
2010-12-07 19:21       ` Junio C Hamano
2010-12-07 19:38         ` Jeff King [this message]
2010-12-07 16:23 ` Casey Dahlin
2010-12-07 17:45   ` Jonathan Nieder
2010-12-07 17:54     ` Casey Dahlin
2010-12-07 18:02       ` Jonathan Nieder
2010-12-07 18:26         ` Casey Dahlin
2010-12-07 20:25         ` Junio C Hamano
2010-12-07 20:55           ` Jonathan Nieder
2010-12-07 18:12       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101207193804.GA27685@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).