Is there a simple way to backup an entire git repo including all branches and tags?
Whats about just make a clone of it?
git clone --mirror other/repo.git
Every repository is a backup of its remote.
@Daniel: If you clone a repository, you fetch every branch, but only the default one is checkouted. Try
git branch -a
. Maybe its more obvious this way: After cloning a repository you dont fetch every branch, you fetch every commit. Branches only reference to an existing commit.I think he knows the clone command well, if he can ask such a question, and it is clearly not enough for him (because it is a clone, and not a dump). Dumps are different things as simple copies, for example: 1) they are not needed to be optimal (or even capable) for normal work 2) but they are required to have a good resistance and repairibility against data corruption.
@peterh Sure, but
git clone
covers all that. (1) is optional, not a requirement. If the result is still optimized, it's still a backup (2) is already covered by git itself. -- The point I'd like to give is, that ifgit clone
already cover the relevant points, for what you need a different tool? Although I also prefergit bundle
I don't think my answer is wrong, or invalid. You can see both approaches as hot- vs cold-backup.what about file permissions? does git clone necessarily copy those over? depends on the options i believe