Re: [PATCH 2/3] remote: separate the concept of push and fetch mirrors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chris <jugg@xxxxxxxxxxx> writes:

>> I use the mirror for synchronizing "local" work between my workstations 
>> (home/office).  So, I use the fact that I can fetch and pull from the mirror.
>
> That of course should say:
>
> So, I use the fact that I can fetch from and *push* to the mirror.

It is not quite clear what you meant by "mirror" above, but I am assuming
that you meant that you have a third repository that you use for the sole
purpose of synchronizing your work done in two repositories, one at home
and the other at office.

The synchronizing point should be a normal remote in such a case.  If you
mirror-push into the mirror from home, you may lose what you have pushed
from office that you forgot to pull back to home before starting to work
at home via the mirror.  If you mirror-fetch from the mirror from office,
you may lose what you worked locally on office and forgot to push out
before mirror-fetching for one thing, and for another, you will be
overwriting the tip of your current branch.

Using a pure mirror in such a three-repository situation _can_ be made to
work, but only if you are very careful: before you leave home, commit
everything and push to the mirror and then go to office; when you come to
the office, fetch from the mirror and "reset --hard" before doing anything
else; before leaving office, commit everything and push to the mirror;
when you come home, fetch from the mirror and "reset --hard" before doing
anything.  Ad infinitum...

Hopefully we are already forbidding mirror fetching into a non-bare
repository, so the system is foolproofed in that direction at least to
avoid such mistakes.  I offhand do not remember if we protect the branch
that is currently checked out from mirror pushing, though.  Hopefully,
receive.denycurrentbranch will protect it, but other branches may happily
get rewound when you do a mirror push.

A safer and more customary way to set up the synchronization between two
repositories is to arrange them to pull from each other (and if you can
initiate connections only in one direction, emulate one side of "git
fetch" with "git push").

In such an arrangement, a local branch "master" at home will correspond to
"refs/remotes/home/master" at the office, and a local branch "master" at
the office will correspond to "refs/remotes/office/master" at home.  There
is no mirror configuration involved.

Hopefully this will clear things up somewhat.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]