How to restore a backup of a git bundle repo while keeping the original remotes

170 views Asked by At

In my repo directory /repo when running git branch --all I have:

* foo
  bar
  baz
  remotes/origin/HEAD -> origin/develop
  remotes/origin/qux
  remotes/origin/quux

I now backup and restore the repo:

$ git bundle create /tmp/repo.bundle --all
$ git clone /tmp/repo.bundle /tmp/repo

And now run git branch --all inside /tmp/repo I get something different:

* foo
  remotes/origin/HEAD -> origin/foo
  remotes/origin/bar
  remotes/origin/baz

How can I make it so it is was identical to the first state instead of the origin being the file (/tmp/repo.bundle)? I noticed that the references to qux and quuxx can still be found in the:

$ git bundle list-heads /tmp/repo.bundle
...
refs/heads/foo
refs/heads/bar
refs/heads/baz
refs/remotes/origin/qux
refs/remotes/origin/quux
0

There are 0 answers