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

From: Joshua Jensen <[email-masked]>
Date: Mon, 19 Jul 2010 11:16:41 -0600

----- Original Message -----
From: Will Palmer
Date: 7/19/2010 1:12 AM
> git branch -d integration
> # git renames refs/heads/integration to refs~/heads~/integration
> git co -b integration sometopic
> # git creates refs/heads/integration, unrelated to the old one
> (do some work)
> (merge into the main branch)
> git branch -d integration
>
> Now what?
> git renames refs/heads/integration to ... what?
> - does the old refs~/heads~/integration get clobbered? If that's ever
> okay, why are we even having this discussion?
> - does the "old reflog" stuff get combined? If that's ever okay, why
> even have an extra reflog, instead of just using the reflog we already
> have?
> - do we move everything else one step down, so refs~/heads~/integration
> becomes refs~2/heads~2/integration? (ie: 2-dimensional reflog, which
> sounds rather too fancy, to me
I was bit by this last week.  I deleted a branch.  A few days later, I 
realized I needed the branch.  It wasn't in the reflog, so I had to look 
through the "lost" objects to find it.

My brain has become muddied with all the ~2 stuff.  Explain again why it 
can't be as simple as this?

git branch -d integration

git reflog

0000001 HEAD@{0}: (fake)checkout: moving from integration to master 
(0000001)
8000000 HEAD@{1}: branch -d: Deleting integration
0000001 HEAD@{2}: (fake)checkout: moving from master to integration 
(8000000)

git checkout -b integration HEAD@{1}  (or 8000000)

-Josh