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

Re: Syncing Git Repositories

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2014, 16:35 UTC
Message-ID
<xmqq61iwq6yb.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqwqbcv5m0.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 30 quoted lines
> Sajan Parikh <sajan@parikh.io> writes:
>
>> By syncing my code folder and git repositories in this way, do I risk
>> borking any repositories?  I'm 99% confident I'm not, since everything
>> is in .git/, and there are not external databases or log files that
>> need to be updated.  Just making sure though.
>
> You're right that there are no external database, hence if you actually
> sync the whole worktree+.git/, you won't have any problem.
>
> I synchonize a bunch of Git repositories between machines with Unison
> (file transfer utility), it works great.
>
> One issue you may encounter is if you have either partial
> synchronization (e.g. network loss in the middle of a synchronization, I
> don't know how owncloud deals with it), or two way synchronization
> (there's a synchronization between your laptop and owncloud ongoing, and
> you start working on your desktop and trigger a synchronization.
>
> I sometimes encounter this situation with unison. The good news is that
> in 99,999% of cases where I'd encounter a problem, Unison shows a
> conflict on the index file (modified on both sides). So, in these cases,
> I just use Git normally to synchronize, decide that one side becomes the
> reference, and rsync to the other to resolve the Unison conflict.
>
> Also, you have to ensure that you synchronize both file
> additions/modifications, and file deletions. I often make the mistake of
> using rsync without --delete, and it confuses the branch storage format
> (I keep my local unpacked branch, and the packed branch is hidden by
> it).

All correct but .git/index may need to be refreshed, as your cloudSync is unlikely to sync stat details across filesystems, especially inum and possibly uid.

Previous: Matthieu Moy
Message 3 of 3 in “Syncing Git Repositories”
  1. Sajan ParikhJul 17, 2014
  2. Matthieu MoyJul 17, 2014
  3. Junio C HamanoJul 17, 2014

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.