Skip to contentSkip to conversation

Losing branches (whee, data loss)

DISCUSSION Jeff Garzik 4 participants 10 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 9 lines · Jeff Garzik

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

#2 lore raw
Quoted 12 lines · Junio C Hamano
Quoted 9 lines · Jeff Garzik

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

Quoted 6 lines

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

Quoted 1 line

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

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

Jeff

#3 lore raw
In reply to Jeff Garzik
Quoted 3 lines · Jeff Garzik

[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?

Quoted 5 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?

Signature · 1 line
larsh
#4 lore raw
Quoted 6 lines · Lars Hjemli
Quoted 3 lines · Jeff Garzik

[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

Quoted 7 lines
Quoted 5 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

#5 lore raw
Quoted 15 lines · Jeff Garzik
Quoted 6 lines · Lars Hjemli
Quoted 3 lines · Jeff Garzik

[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

Quoted 3 lines
Quoted 3 lines

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

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

[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' <[email protected]>

#6 lore raw
Quoted 1 line · Jan Hudec

And does the .git/logs/refs/heads/upstream-fixes still exist?

Nope.

Quoted 4 lines

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

#7 lore raw
Quoted 6 lines · Jeff Garzik
Quoted 1 line · Jan Hudec

And does the .git/logs/refs/heads/upstream-fixes still exist?

Nope.

Quoted 7 lines
Quoted 4 lines

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.

#8 lore raw
In reply to Jeff Garzik
Quoted 6 lines · Jeff Garzik
Quoted 1 line · Jan Hudec

And does the .git/logs/refs/heads/upstream-fixes still exist?

Nope.

Quoted 8 lines
Quoted 4 lines

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

#9 lore raw
Quoted 12 lines · Lars Hjemli
Quoted 11 lines · Jeff Garzik
Quoted 1 line · Jan Hudec

And does the .git/logs/refs/heads/upstream-fixes still exist?

Nope.

Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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