git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to backup git

From
Jakub Narebski <jnareb@gmail.com>
Date
May 12, 2008, 18:54 UTC
Message-ID
<m38wyf4als.fsf@localhost.localdomain>
In-Reply-To
<alpine.DEB.1.00.0805121920120.30431@racer>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 5 quoted lines
> 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:
Show 17 quoted lines
>>>> 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
Previous: Sverre RabbelierNext: Daniel Barkalow
Message 18 of 21 in “how to backup git”
  1. bill lamMay 12, 2008
  2. Tobias SarnowskiMay 12, 2008
  3. Sverre Hvammen JohansenMay 12, 2008
  4. Eric HanchrowMay 12, 2008
  5. Johannes SchindelinMay 12, 2008
  6. bill lamMay 12, 2008
  7. Miklos VajnaMay 12, 2008
  8. Johannes SchindelinMay 12, 2008
  9. Heikki OrsilaMay 12, 2008
  10. Johannes SchindelinMay 12, 2008
  11. Heikki OrsilaMay 12, 2008
  12. Johannes SchindelinMay 12, 2008
  13. Heikki OrsilaMay 12, 2008
  14. Heikki OrsilaMay 12, 2008
  15. Tim HarperMay 12, 2008
  16. Heikki OrsilaMay 12, 2008
  17. Sverre RabbelierMay 12, 2008
  18. Jakub NarebskiMay 12, 2008
  19. Daniel BarkalowMay 12, 2008
  20. Junio C HamanoMay 12, 2008
  21. Daniel BarkalowMay 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.