Re: Pull From Mirrored Repository

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

 



On 19 September 2011 00:45, Jean Sacren <sakiwit@xxxxxxxxx> 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
--
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]