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.