* Pull From Mirrored Repository
@ 2011-09-18 14:45 Jean Sacren
2011-09-18 15:15 ` Andrew Ardill
0 siblings, 1 reply; 3+ messages in thread
From: Jean Sacren @ 2011-09-18 14:45 UTC (permalink / raw)
To: git
After pull from a mirrored repository, git status shows
# On branch master
# Your branch is ahead of 'origin/master' by [NUMBER] commits.
#
nothing to commit (working directory clean)
How to bring 'origin/master' update without syncing with the original
repository?
Thanks,
--
Jean Sacren
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pull From Mirrored Repository
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
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Ardill @ 2011-09-18 15:15 UTC (permalink / raw)
To: Jean Sacren; +Cc: git
On 19 September 2011 00:45, Jean Sacren <sakiwit@gmail.com> wrote:
> After pull from a mirrored repository, git status shows
>
> # On branch master
> # Your branch is ahead of 'origin/master' by [NUMBER] commits.
> #
> nothing to commit (working directory clean)
>
>
> How to bring 'origin/master' update without syncing with the original
> repository?
>
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
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by [NUMBER] commits.
#
nothing to commit (working directory clean)
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)?
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.
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 assumes that you have already added mirror as a remote ref.
Regards,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pull From Mirrored Repository
2011-09-18 15:15 ` Andrew Ardill
@ 2011-09-18 20:06 ` Jean Sacren
0 siblings, 0 replies; 3+ messages in thread
From: Jean Sacren @ 2011-09-18 20:06 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-18 20:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).