From: Junio C Hamano <gitster@pobox.com>
To: Eugene Sajine <euguess@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: need help with syncing two bare repos
Date: Fri, 03 Aug 2012 14:34:42 -0700 [thread overview]
Message-ID: <7vy5lvacct.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAPZPVFZpLBXG0Ntbf06dWRS_Z4hVzMXF-2FmfqvT2mN9A8Ektg@mail.gmail.com> (Eugene Sajine's message of "Fri, 3 Aug 2012 16:31:41 -0400")
Eugene Sajine <euguess@gmail.com> writes:
> On Fri, Aug 3, 2012 at 4:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Eugene Sajine <euguess@gmail.com> writes:
>>
>>> I think the best variant would be to do something like:
>>>
>>> $ git pull --rebase /refs/heads/*:/refs/heads/*
>>> $ git push origin /refs/heads/*:/refs/heads/*
>>
>> You perhaps meant "worst" not "best" here. From the point of view
>> of people who have pushed into the "origin" repository we see above,
>> their history is rewritten; you are screwing half the population by
>> doing this.
>>
>> Not allowing B to accept pushes while it is not positively sure that
>> A has gone down would of course be the best solution (in your scenario,
>> B started serving when it merely found out that *it* cannot contact
>> A), but barring that, the recovery for two histories at A and B,
>> once they diverged, should be to "merge" corresponding branches.
>
> ... but wouldn't merge result in the same
> history changes for people pushing to the origin (bareA)?
> Still all their consequent changes will not be fast-forwardable
> because of merge commit. Or am i missing something?
Welcome to the world of distributed version control.
Even with a single server, it always is possible that other people
have been working on their changes and pushed their results out
while you are working on your changes when you are working with
others. It is perfectly expected that your changes may not be
fast-forwardable. In such a case, you can, and you are expected to,
fetch the updated tip from the public meeting point, integrate your
work with it and then push the result back.
That is not an issue.
If the project has "strictly linear history only" policy [*1*], then
the "fetch the updated tip, integrate your work and push back" would
involve a rebase on the participant's part, and only in that very
narrow context, it wouldn't make a difference if you rebase at the
server end while doing your recovery procedure. In a way, the
rebase during your recovery procedure is doing the rebase the
particupants would have to perform anyway for them.
But in a more general workflow where project participants are either
allowed or encouraged to merge (as opposed to rebase and immediately
push the untested results out), the history resulting from a merge
by a participant, when he finds that what he has is not a strict
descendant of the recovered A's history, will contain the commits he
made originally to A when it was half-alive and their doppelgänger
commits your recovery procedure produced by rebasing, which is a
disaster.
[Footnote]
*1* Projects can enforce strictly linear history by rejecting push
of a history with any merges in their pre-receive hooks. Such a
practice may be denying its participants major benefit of Git,
namely, distributedness, but it is probably easier to explain to
people coming from CVS or systems where branching and merging are
impossibly hard.
prev parent reply other threads:[~2012-08-03 21:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 18:29 need help with syncing two bare repos Eugene Sajine
2012-08-03 19:14 ` Sitaram Chamarty
2012-08-03 20:00 ` Junio C Hamano
2012-08-03 20:31 ` Eugene Sajine
2012-08-03 21:34 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vy5lvacct.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=euguess@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).