threads / discuss / 8175

Losing branches (whee, data loss)

Subject: Losing branches (whee, data loss)

## tl;dr

10 messages between May 16, 2007 and May 16, 2007.

replies: 9people: 4as markdown or json

Jeff Garzik· May 16, 2007, 05:18 UTC · lore
Grumble!

When all this started, the branch 'upstream-fixes' exists, and branch 'tmp' does not exist. This is my local clone of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

[jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp error: Could not open config file! fatal: Branch rename failed

[jgarzik@pretzel libata-dev]$ git-branch -m upstream-fixes tmp fatal: A branch named 'tmp' already exists.

[jgarzik@pretzel libata-dev]$ git branch -D tmp Deleted branch tmp.

[jgarzik@pretzel libata-dev]$ git-branch -m upstream-fixes tmp error: refname refs/heads/upstream-fixes not found fatal: Branch rename failed

Lars Hjemli· May 16, 2007, 05:48 UTC · re: Jeff Garzik · lore

Re: Losing branches (whee, data loss)

On 5/16/07, Jeff Garzik <jeff@garzik.org> wrote:
> [jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp
> error: Could not open config file!
> fatal: Branch rename failed
This should have been fixed in v1.5.1.1, what version do you run?
Show 5 quoted lines
> [jgarzik@pretzel libata-dev]$ git-branch -m upstream-fixes tmp
> fatal: A branch named 'tmp' already exists.
>
> [jgarzik@pretzel libata-dev]$ git branch -D tmp
> Deleted branch tmp.
Could you try to run "git log -g" and see if it finds your lost branch?
-- 
larsh
Jeff Garzik· May 16, 2007, 05:54 UTC · re: Lars Hjemli · lore

Re: Losing branches (whee, data loss)

Lars Hjemli wrote:
Show 6 quoted lines
> On 5/16/07, Jeff Garzik <jeff@garzik.org> wrote:
>> [jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp
>> error: Could not open config file!
>> fatal: Branch rename failed
> 
> This should have been fixed in v1.5.1.1, what version do you run?

[jgarzik@core ~]$ rpm -q git-core git-core-1.5.0.6-1.fc6

Show 7 quoted lines
>> [jgarzik@pretzel libata-dev]$ git-branch -m upstream-fixes tmp
>> fatal: A branch named 'tmp' already exists.
>>
>> [jgarzik@pretzel libata-dev]$ git branch -D tmp
>> Deleted branch tmp.
> 
> Could you try to run "git log -g" and see if it finds your lost branch?
Doesn't seem to..
Thanks,
	Jeff
Jan Hudec· May 16, 2007, 06:14 UTC · re: Jeff Garzik · lore

Re: Losing branches (whee, data loss)

On Wed, May 16, 2007 at 01:54:35AM -0400, Jeff Garzik wrote:
Show 21 quoted lines
> Lars Hjemli wrote:
> >On 5/16/07, Jeff Garzik <jeff@garzik.org> wrote:
> >>[jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp
> >>error: Could not open config file!
> >>fatal: Branch rename failed
> >
> >This should have been fixed in v1.5.1.1, what version do you run?
> 
> [jgarzik@core ~]$ rpm -q git-core
> git-core-1.5.0.6-1.fc6
> 
> 
> >>[jgarzik@pretzel libata-dev]$ git-branch -m upstream-fixes tmp
> >>fatal: A branch named 'tmp' already exists.
> >>
> >>[jgarzik@pretzel libata-dev]$ git branch -D tmp
> >>Deleted branch tmp.
> >
> >Could you try to run "git log -g" and see if it finds your lost branch?
> 
> Doesn't seem to..
And does the .git/logs/refs/heads/upstream-fixes still exist?

If it does, than revspec upstream-fixes@{1} would still work, so you can check it out, re-create the branch and update the ref (git update-ref).

If it does not, as last resort you'd have to git fsck --unreachable (this gives you all things that are not reachable from any ref), filter out only commit objects and than remember which one should have been on that branch after reading it's log, date and changes.

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
Jeff Garzik· May 16, 2007, 06:40 UTC · re: Jan Hudec · lore

Re: Losing branches (whee, data loss)

Jan Hudec wrote:
> And does the .git/logs/refs/heads/upstream-fixes still exist?
Nope.
> If it does not, as last resort you'd have to git fsck --unreachable
> (this gives you all things that are not reachable from any ref), filter
> out only commit objects and than remember which one should have been on
> that branch after reading it's log, date and changes.

Yeah, that will probably recover it. I wound up digging the emails out of the trash bin, and applying them again.

	Jeff
Junio C Hamano· May 16, 2007, 06:43 UTC · re: Jeff Garzik · lore

Re: Losing branches (whee, data loss)

Jeff Garzik <jeff@garzik.org> writes:
Show 13 quoted lines
> Jan Hudec wrote:
>> And does the .git/logs/refs/heads/upstream-fixes still exist?
>
> Nope.
>
>
>> If it does not, as last resort you'd have to git fsck --unreachable
>> (this gives you all things that are not reachable from any ref), filter
>> out only commit objects and than remember which one should have been on
>> that branch after reading it's log, date and changes.
>
> Yeah, that will probably recover it.  I wound up digging the emails
> out of the trash bin, and applying them again.

Ah, sorry to hear that. Trying to rename and lost both old and new -- that is bad.

Lars Hjemli· May 16, 2007, 07:10 UTC · re: Jeff Garzik · lore

Re: Losing branches (whee, data loss)

On 5/16/07, Jeff Garzik <jeff@garzik.org> wrote:
Show 14 quoted lines
> Jan Hudec wrote:
> > And does the .git/logs/refs/heads/upstream-fixes still exist?
>
> Nope.
>
>
> > If it does not, as last resort you'd have to git fsck --unreachable
> > (this gives you all things that are not reachable from any ref), filter
> > out only commit objects and than remember which one should have been on
> > that branch after reading it's log, date and changes.
>
> Yeah, that will probably recover it.  I wound up digging the emails out
> of the trash bin, and applying them again.
>
That's bad.
Just out of curiosity: do you get any output from 'git log RENAMED-REF'?

-- larsh

Junio C Hamano· May 16, 2007, 07:36 UTC · re: Lars Hjemli · lore

Re: Losing branches (whee, data loss)

"Lars Hjemli" <hjemli@gmail.com> writes:
Show 19 quoted lines
> On 5/16/07, Jeff Garzik <jeff@garzik.org> wrote:
>> Jan Hudec wrote:
>> > And does the .git/logs/refs/heads/upstream-fixes still exist?
>>
>> Nope.
>>
>>
>> > If it does not, as last resort you'd have to git fsck --unreachable
>> > (this gives you all things that are not reachable from any ref), filter
>> > out only commit objects and than remember which one should have been on
>> > that branch after reading it's log, date and changes.
>>
>> Yeah, that will probably recover it.  I wound up digging the emails out
>> of the trash bin, and applying them again.
>>
>
> That's bad.
>
> Just out of curiosity: do you get any output from 'git log RENAMED-REF'?

Another probably easier way to recover them would be 'git lost-found'.

Junio C Hamano· May 16, 2007, 06:12 UTC · re: Jeff Garzik · lore

Re: Losing branches (whee, data loss)

Jeff Garzik <jeff@garzik.org> writes:
Show 9 quoted lines
> Grumble!
>
> When all this started, the branch 'upstream-fixes' exists, and branch
> 'tmp' does not exist.  This is my local clone of
> git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
>
> [jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp
> error: Could not open config file!
> fatal: Branch rename failed
Sorry to hear that.

We used to have a problem with "branch -m" when you did not have a .git/config file (or it was unwritable). I think 1.5.0.X series and 1.5.1 release had this bug; 1.5.1.1 and later should have the appropriate fix.

Was this really a "whee, data loss", I wonder...?
Jeff Garzik· May 16, 2007, 06:40 UTC · re: Junio C Hamano · lore

Re: Losing branches (whee, data loss)

Junio C Hamano wrote:
Show 18 quoted lines
> Jeff Garzik <jeff@garzik.org> writes:
> 
>> Grumble!
>>
>> When all this started, the branch 'upstream-fixes' exists, and branch
>> 'tmp' does not exist.  This is my local clone of
>> git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
>>
>> [jgarzik@pretzel libata-dev]$ git branch -m upstream-fixes tmp
>> error: Could not open config file!
>> fatal: Branch rename failed
> 
> Sorry to hear that.
> 
> We used to have a problem with "branch -m" when you did not have
> a .git/config file (or it was unwritable).  I think 1.5.0.X
> series and 1.5.1 release had this bug; 1.5.1.1 and later should
> have the appropriate fix.
Using the latest version from Fedora Extras: git-core-1.5.0.6-1.fc6
> Was this really a "whee, data loss", I wonder...?

The branches definitely went away. The sha1-indexed commits are probably still there...

	Jeff

← back to recent threads