0

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 
7
  • 2
    git bundle is like git clone or git 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 use git 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. Commented Apr 21, 2022 at 22:06
  • 2
    If you don't want it to do that, you may need 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. Commented Apr 21, 2022 at 22:08
  • 2
    If you want to go beyond that, you'll need to learn about the internals of Git. But the point here is that git bundle is not a backup system (nor is Git). Use a backup system to make backups. Commented Apr 21, 2022 at 22:08
  • Ahh okay thank you. Can you reccomend a backup system - I am worrried about backing up maybe a not very clean .git folder with locks or something. Commented Apr 21, 2022 at 22:43
  • On my Mac, I let Time Machine do the backups. If the backup happens while Git is running, the locks do get backed-up, but this is not a big deal as Git will let you "break" the lock later if necessary. Commented Apr 21, 2022 at 23:01

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.