Subject: Re: Question about 'branch -d' safety

From: Clemens Buchacher <[email-masked]>
Date: Tue, 13 Jul 2010 09:13:17 +0200

On Mon, Jul 12, 2010 at 04:50:32PM -0700, Junio C Hamano wrote:
> 
> I am not entirely unsympathetic to add "git branch --undelete frotz" to our
> vocabulary, but then we should leave users an easy way to really remove
> things, and it shouldn't be "git branch -d --i-really-mean-it frotz".
> 
> It would probably be more like "git branch -d frotz" followed by "git
> branch --purge frotz" or "git branch --purge \*" (if we name the operation
> to remove cruft for undelete "purge", that is).

Why would we need that? Even now, it is not enough to do "git
branch -D frotz; git gc --prune". You need to expire the reflog,
since HEAD may still have a reference to it. So instead you would
need

 git branch -D frotz
 git reflog expire --expire=now HEAD frotz
 git gc --prune

Purging a branch becomes just a special case of purging anything
from history.

Clemens