Subject: Re: how to backup git

From: Jakub Narebski <[email-masked]>
Date: Mon, 12 May 2008 11:54:15 -0700 (PDT)

Johannes Schindelin <[email-masked]> writes:

> On Mon, 12 May 2008, Heikki Orsila wrote:
> 
>> On Mon, May 12, 2008 at 06:07:28PM +0100, Johannes Schindelin wrote:
>> 
>>> On Mon, 12 May 2008, Heikki Orsila wrote:
 
>>>> Is there a simple and efficient mechanism for incremental backups?
>>> 
>>> Umm.  "git fetch"?
>>> 
>>> Like I said, it does not get the reflogs, but if you want to back up a 
>>> repository, the safest is to clone once, and fetch later.  Or you 
>>> could set up a remote with the --mirror option, if you want to 
>>> preserve the refs' namespaces.
>> 
>> Preferably some solution that does not require too much understanding of 
>> Git internals so that admins will actually use it, instead of hacking 
>> their own inefficient backup scripts.
>> 
>> Could someone please write a "git-backup" script?-)
> 
> Heikki, why don't you just go with the "git fetch" approach I described?  
> We do not need "git backup" when "git fetch" does already what you want.

I think that bundles (see git-bundle) would be what you want (please
read GitFaq/GitTips/"Git in Nutshell" for explanation and use cases).

"git fetch" (perhaps using bundle) would save state of refs (heads,
remote branches, tags) and object repository.  To save state of
working area and index I think it would be best to use 'git-stash'
before creating backup, and unstash after it; see documentation for
git-stash.  What is left is: reflogs, configuration, hooks, grafts and
shallow, repository local excludes file, repository local attributes
file[*1*].

[*1*] Which is not mentioned in Documentation/repository-layout.txt
-- 
Jakub Narebski
Poland
ShadeHawk on #git