Re: Question about 'branch -d' safety
- From
Joshua Jensen <jjensen@workspacewhiz.com>
- Date
- Jul 19, 2010, 17:16 UTC
- Message-ID
- <4C448879.4040202@workspacewhiz.com>
- In-Reply-To
- <1279523523.3077.8.camel@dreddbeard>
----- Original Message ----- From: Will Palmer Date: 7/19/2010 1:12 AM
Show 18 quoted lines
> 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