Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have read Backing up Git Repositories, which recommends using git clone, as does everyone everywhere else. But I have some big stuff, and a slow connection at the other end. Would it be sufficient to clone it once, and then just perform a git fetch --all later on? It is important to get all branches. What would you recommend?

Thanks.

share|improve this question

1 Answer 1

Using a single clone may be sufficient as a backup. But if you only have a single remote using the --all argument of git fetch won't accomplish anything, since that just tells git to fetch from all configured remotes.

If you want to ensure that you get all refs (including branches), you could run

git config --add remote.origin.fetch '+refs/*:refs/backup/*'

This would cause all refs from the remote to be fetched into a separate backup namespace of your refs hierarchy. These refs will not show up in the output of git branch even with the -a option.

Another option would be to first clone from your existing local repository to get all of the large objects into your backup clone without using the network (if your filesystem supports hard links even the disk space would be shared) then switch that over to fetching updates from the repository that you wish to backup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.