git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Pull From Mirrored Repository

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Sep 18, 2011, 15:15 UTC
Message-ID
<CAH5451m1WJ0H9G8uHbCqZ5acO-xEynGKjMk=6g75buJy1S7iSw@mail.gmail.com>
In-Reply-To
<20110918144514.GL15295@mail.gmail.com>
On 19 September 2011 00:45, Jean Sacren <sakiwit@gmail.com> wrote:
Show 11 quoted lines
> 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

Previous: Jean SacrenNext: Jean Sacren
Message 2 of 3 in “Pull From Mirrored Repository”
  1. Jean SacrenSep 18, 2011
  2. Andrew ArdillSep 18, 2011
  3. Jean SacrenSep 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.