git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Sacren <sakiwit@gmail.com>
To: git@vger.kernel.org
Subject: Re: Pull From Mirrored Repository
Date: Sun, 18 Sep 2011 14:06:33 -0600	[thread overview]
Message-ID: <20110918200633.GN15295@mail.gmail.com> (raw)
In-Reply-To: <CAH5451m1WJ0H9G8uHbCqZ5acO-xEynGKjMk=6g75buJy1S7iSw@mail.gmail.com>

From: Andrew Ardill <andrew.ardill@gmail.com>
Date: Mon, 19 Sep 2011 01:15:47 +1000
>
> Am I correct in thinking that you have done the following:
> 
> $ git clone original-server/repo.git
> $ cd repo
> $ git pull mirror-server/repo.git

Essentially that's what I did.

> and now you want the remote ref 'origin/master' to point to the same
> thing as 'mirror/master' (assuming that you create the ref for the
> mirror)?

The idea is to update the local tree from multiple sites so long as one
of them is still running. And the update shall make no difference
whether it is from the master site or not.

> This can be done (by editing the file .git/refs/remotes/origin/master
> and specifying the correct sha1) however this is probably not the best
> idea. It is best for git to know the actual state of the remote the
> last time you synced with it so that it can act intelligently the next
> time you sync with it.

It turns out to be more of a bug with git. After a successful pull from
a master or mirror site, the SHA1 shall be updated among all the master
files in .git/refs/remotes/origin or .git/refs/remotes/[WHATEVER_MIRROR]
as the tip of the local tree is updated.

> If you intend to sync with the mirror, you might as well set it as the
> upstream ref of you master branch. That way you will not get the 'Your
> branch is ahead' message when you pull new updates (unless you have
> local changes, of course).
> This can be done by:
> $ git checkout master
> $ git branch --set-upstream mirror

This is a nice hack, but we want all the changes stay with the master
branch. It's easier to use one master branch for tracking all updates
from the upstream.

Thank you for all your help!

-- 
Jean Sacren

      reply	other threads:[~2011-09-18 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-18 14:45 Pull From Mirrored Repository Jean Sacren
2011-09-18 15:15 ` Andrew Ardill
2011-09-18 20:06   ` Jean Sacren [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=20110918200633.GN15295@mail.gmail.com \
    --to=sakiwit@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).