Re: how to backup git
- From
Sverre Hvammen Johansen <hvammen@gmail.com>
- Date
- May 12, 2008, 06:40 UTC
- Message-ID
- <loom.20080512T062707-662@post.gmane.org>
- In-Reply-To
- <4827DEF6.1050005@gmail.com>
bill lam <cbill.lam <at> gmail.com> writes:
> Hello, this should be a simple question. How to backup a git repository but > excluding files that not under versioned? If I cp or tar or rsync the > directory. All non-versioned files are added.
A repository can be backed up by backing up the .git directory.
If you want to back up the HEAD commit, use git-archive as follows:
$ git archive --prefix=my-backup/ HEAD | gzip >my-backup.tar.gz
If you want to back up the working directory, commit it to a temporary branch before you use 'git archive'.
-- Sverre Hvammen Johansen