Back up your repositories as mirror repositories

Though Git is distributed and every clone essentially is a backup, there are some tricks that can be useful when backing up Git repositories. A normal Git repository has a working copy of the files it tracks and the full history of the repository in the .git folder of that repository. The repositories on the server, the one you push to and pull from, will usually be bare repositories. A bare repository is a repository without a working copy. Roughly, it is just the .git folder of a normal repository. A mirror repository is almost the same as a bare repository, except it fetches all the references under refs/*, where a bare only fetches the references that fall under refs/heads/*. We'll now take ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.