I'm a solo developer, working in a local Git repository. For backups, I want to send an exact copy of that repository off to another server.
Is it sufficient to do this?
git push --mirror
I'm asking because I can sometimes run this command two or three times before Git tells me "Everything up-to-date", so apparently it's not an exact mirror. It seems to be re-pushing tracking branches...?
$ git push --mirror
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (30/30), done.
Writing objects: 100% (30/30), 5.09 KiB, done.
Total 30 (delta 17), reused 0 (delta 0)
To ssh://my/repo/url
c094a10..0eedc92 mybranch -> mybranch
$ git push --mirror
Total 0 (delta 0), reused 0 (delta 0)
To ssh://my/repo/url
c094a10..0eedc92 origin/mybranch -> origin/mybranch
$ git push --mirror
Everything up-to-date
What is happening, and is this a good strategy?
Edit: I don't like to use something like git bundle
or .tar.bz2
archives, because I'd like the backup to be an accessible working copy. Since my backup server is connected to the net and always on, this is a nice way to access the repository when I'm on the road.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…