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
git bundle
is likegit clone
orgit fetch
but split up so that you can do it even if you don't have a network connection between two computers. If you do have a network connection and were to usegit clone
to copy your repository from your laptop to, say, Fred's laptop, you'd get this same effect. It's supposed to do that, in other words.git clone --mirror
, but note that this makes a bare clone (specifically a bare mirror clone), which literally cannot be used for anything else. So you probably don't want that after all.git bundle
is not a backup system (nor is Git). Use a backup system to make backups.