On Mon, 30 Mar 2015 12:12:01 -0700 (PDT)
Frank Gutierrez <dearfra...@gmail.com> wrote:

> *My backup.git repo looks bad.*
> git br 
> git br -a
> both show nothing.

Then I'm afraid someone did delete all the branches in the bare
repository.  If `git fsck` shows OK in it, it's supposedly OK, and the
problem of the missing branches is elsewhere.

On the other hand, in your original post you've said you have a bunch
of seemingly valid entries under refs/heads in your bare repo.
If so, I don't know why `git branch -a` shows nothing about them and
not fails with an error at the same time.

I'd start with extracting SHA-1 names of the target commit objects from
those files under refs/heads and grepping the Git object database for
them, like this:

  cd ~/path/to/bare/repo.git
  find refs/heads/ -type f -print \
    | while read f; do cat $f; done >/tmp/names
  git rev-list --objects --all | grep -Fw -f /tmp/names

If the last command will output more than a single entry┬╣, this means
you still do have commit objects of your "lost" branches in your object
store, and you can easily "regain" them by, say, sticking tags onto
those SHA-1 names and then studying the commit logs leading to each
resulting tag.

┬╣ You showed that Git itself reports there's a single branch, so you
  ought to see its commit object in the output anyway.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to