What is the best way to back up an entire git repository on external disk?
backup, git, repository
Solution
Copying the entire working copy using regular file system copy commands works fine. You can also zip/tar the backup.
If you are worried about disk space, you can also look at "git bundle", which could produce smaller files.
You can also get incremental backups by just starting a new repo on the external disk (git clone) and then pull the changes every time (git pull). There is not much difference between a backup and a working copy in a distributed system like git.
Problem
So I want to be able to back up a git repository that may have several branches onto an external hard drive and then be at a later time be able to copy it back onto my local machine and work with it as usual? I have tried simply copying the working directory folder containing the .git directory and it worked. However, I was wondering if this was the best way or if it had pitfalls later.