All of lore.kernel.org
 help / color / mirror / Atom feed
* Syncing Git Repositories
@ 2014-07-17  2:26 Sajan Parikh
  2014-07-17  6:53 ` Matthieu Moy
  0 siblings, 1 reply; 3+ messages in thread
From: Sajan Parikh @ 2014-07-17  2:26 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1662 bytes --]

On all my laptops and desktops, I have a directory at /home/sajan/Code 
where all my active projects and repositories live.

/home/sajan/Code/repository1
/home/sajan/Code/repository2
/home/sajan/Code/repository3

...etc...

Up until now I've relied on pushing and pulling to and from my Gitlab 
server to keep my projects in sync across all my laptops and desktops.  
It's worked great.

However, today I decided to add my code folder to my ownCloud server and 
sync it across all my laptops and desktops the same way I do for 
/home/sajan/Documents, /home/sajan/Music, and a few application config 
directories to keep all my devices in sync.

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.

I'm only doing this because sometimes I forget to pull changes down from 
my Gitlab server on a different laptop or desktop and start making local 
changes.  Which is fine, I can merge easily, but if everything were 
sync'd automatically when I logged into my computer it would be great.

Another option I thought of would be to write a bash script that 
executed at login and went into each of my repositories and ran git 
pull, but I decided against this because of legitimate non-fast-forward 
merges.

TLDR;

If I sync my repositories across computers using something similar to 
Dropbox, rather than pushing/pulling to and from an central repository, 
am I risking borking any respository?

-- 
Sajan Parikh



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syncing Git Repositories
  2014-07-17  2:26 Syncing Git Repositories Sajan Parikh
@ 2014-07-17  6:53 ` Matthieu Moy
  2014-07-17 16:35   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Moy @ 2014-07-17  6:53 UTC (permalink / raw)
  To: Sajan Parikh; +Cc: git

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).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syncing Git Repositories
  2014-07-17  6:53 ` Matthieu Moy
@ 2014-07-17 16:35   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-07-17 16:35 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Sajan Parikh, git

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-17 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-17  2:26 Syncing Git Repositories Sajan Parikh
2014-07-17  6:53 ` Matthieu Moy
2014-07-17 16:35   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.