# Losing branches (whee, data loss)

10 messages from 2007-05-16 to 2007-05-16. Participants: Jeff Garzik, Lars Hjemli, Junio C Hamano, Jan Hudec.
Thread: https://gitlist.dev/t/8175

## Jeff Garzik, 2007-05-16 05:18

Subject: Losing branches (whee, data loss)
Message-ID: <464A940C.3080906@garzik.org>
URL: https://gitlist.dev/e/464A940C.3080906%40garzik.org

```
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, 2007-05-16 05:48

Subject: Re: Losing branches (whee, data loss)
Message-ID: <8c5c35580705152248w254e4201w65da1e1ad229f6ee@mail.gmail.com>
URL: https://gitlist.dev/e/8c5c35580705152248w254e4201w65da1e1ad229f6ee%40mail.gmail.com
In-Reply-To: <464A940C.3080906@garzik.org>

```
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@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, 2007-05-16 05:54

Subject: Re: Losing branches (whee, data loss)
Message-ID: <464A9C9B.70904@garzik.org>
URL: https://gitlist.dev/e/464A9C9B.70904%40garzik.org
In-Reply-To: <8c5c35580705152248w254e4201w65da1e1ad229f6ee@mail.gmail.com>

```
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..

Thanks,

	Jeff

```

## Junio C Hamano, 2007-05-16 06:12

Subject: Re: Losing branches (whee, data loss)
Message-ID: <7vtzudfgam.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vtzudfgam.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <464A940C.3080906@garzik.org>

```
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.

Was this really a "whee, data loss", I wonder...?

```

## Jan Hudec, 2007-05-16 06:14

Subject: Re: Losing branches (whee, data loss)
Message-ID: <20070516061449.GA25273@artax.karlin.mff.cuni.cz>
URL: https://gitlist.dev/e/20070516061449.GA25273%40artax.karlin.mff.cuni.cz
In-Reply-To: <464A9C9B.70904@garzik.org>

```
On Wed, May 16, 2007 at 01:54:35AM -0400, Jeff Garzik wrote:
> 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, 2007-05-16 06:40

Subject: Re: Losing branches (whee, data loss)
Message-ID: <464AA749.90101@garzik.org>
URL: https://gitlist.dev/e/464AA749.90101%40garzik.org
In-Reply-To: <7vtzudfgam.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:
> 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

```

## Jeff Garzik, 2007-05-16 06:40

Subject: Re: Losing branches (whee, data loss)
Message-ID: <464AA773.3090808@garzik.org>
URL: https://gitlist.dev/e/464AA773.3090808%40garzik.org
In-Reply-To: <20070516061449.GA25273@artax.karlin.mff.cuni.cz>

```
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, 2007-05-16 06:43

Subject: Re: Losing branches (whee, data loss)
Message-ID: <7viratfev8.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7viratfev8.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <464AA773.3090808@garzik.org>

```
Jeff Garzik <jeff@garzik.org> writes:

> 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, 2007-05-16 07:10

Subject: Re: Losing branches (whee, data loss)
Message-ID: <8c5c35580705160010s506b6f53y4209c1b541c3112a@mail.gmail.com>
URL: https://gitlist.dev/e/8c5c35580705160010s506b6f53y4209c1b541c3112a%40mail.gmail.com
In-Reply-To: <464AA773.3090808@garzik.org>

```
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'?

--
larsh

```

## Junio C Hamano, 2007-05-16 07:36

Subject: Re: Losing branches (whee, data loss)
Message-ID: <7vejlhfce0.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vejlhfce0.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <8c5c35580705160010s506b6f53y4209c1b541c3112a@mail.gmail.com>

```
"Lars Hjemli" <hjemli@gmail.com> writes:

> 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'.

```
