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

Re: rsync vs. git-push/pull ? (+kudus)

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Sep 10, 2008, 07:05 UTC
Message-ID
<vpqej3sa3bb.fsf@bauges.imag.fr>
In-Reply-To
<dfb262380809062311i3fffb900m5d73f5396b403dbe@mail.gmail.com>
"Ramagudi Naziir" <naziirr@gmail.com> writes:
Show 10 quoted lines
> Hi all,
>
> I have several local git repositories on my machine. I'm the only
> user, and use them only locally. Now, sometimes when I need to work
> remotely, I just rsync my repositories to my laptop, and keep working
> there. When I finish (few hours, days or sometimes weeks later), I
> just rsync everything back to my local git repositories on my main
> workstation, and continue working there.
>
> Now I was wondering whether it's OK or whether there are bad

Clearly, it's more risky to use rsync: git knows which repository is ahead of the other, knows it has to do a merge in case the two diverged, ... but if you really know what you're doing, this should be OK.

Technically, there's at least one case which can be problematic if you "rsync" without "--delete": packed references. For example, the tip of the master branch is normally stored in .git/refs/heads/master, but after packing, git removes this file, and puts all the references in .git/packed-refs (so it's just 1 file, eats less inodes, less round-trips for HTTP fetch, ...). Then, if .git/refs/heads/master is re-created, it takes precedence over .git/packed-refs. So if you "git gc" locally, and then "rsync remote/ local/", you'll end up with an old .git/refs/heads/master that overrides the new .git/packed-refs, and git will behave as if you went backwards in history.

Easily fixable, but I've been hit by this once and took time to understand what was happening ;-).

-- 
Matthieu
Previous: Ramagudi Naziir
Message 7 of 7 in “rsync vs. git-push/pull ? (+kudus)”
  1. Ramagudi NaziirSep 7, 2008
  2. david@lang.hmSep 7, 2008
  3. Ramagudi NaziirSep 10, 2008
  4. david@lang.hmSep 10, 2008
  5. David BrownSep 7, 2008
  6. Ramagudi NaziirSep 10, 2008
  7. Matthieu MoySep 10, 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.