{"thread":{"id":"28419","subject":"Pull From Mirrored Repository","startedAt":"2011-09-18T14:45:15Z","lastAt":"2011-09-18T20:06:33Z","messageCount":3,"participants":["Jean Sacren","Andrew Ardill"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"175719","messageId":"20110918144514.GL15295@mail.gmail.com","threadId":"28419","inReplyTo":null,"subject":"Pull From Mirrored Repository","fromName":"Jean Sacren","fromEmail":"sakiwit@gmail.com","sentAt":"2011-09-18T14:45:15Z","receivedAt":"2011-09-18T14:45:15Z","isPatch":false,"sender":{"key":"sakiwit@gmail.com","avatar":null},"body":"After pull from a mirrored repository, git status shows\n\n# On branch master\n# Your branch is ahead of 'origin/master' by [NUMBER] commits.\n#\nnothing to commit (working directory clean)\n\n\nHow to bring 'origin/master' update without syncing with the original\nrepository?\n\nThanks,\n\n-- \nJean Sacren\n"},{"id":"175723","messageId":"CAH5451m1WJ0H9G8uHbCqZ5acO-xEynGKjMk=6g75buJy1S7iSw@mail.gmail.com","threadId":"28419","inReplyTo":"20110918144514.GL15295@mail.gmail.com","subject":"Re: Pull From Mirrored Repository","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2011-09-18T15:15:47Z","receivedAt":"2011-09-18T15:15:47Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"On 19 September 2011 00:45, Jean Sacren <sakiwit@gmail.com> wrote:\n> After pull from a mirrored repository, git status shows\n>\n> # On branch master\n> # Your branch is ahead of 'origin/master' by [NUMBER] commits.\n> #\n> nothing to commit (working directory clean)\n>\n>\n> How to bring 'origin/master' update without syncing with the original\n> repository?\n>\n\nAm I correct in thinking that you have done the following:\n\n$ git clone original-server/repo.git\n$ cd repo\n$ git pull mirror-server/repo.git\n$ git status\n# On branch master\n# Your branch is ahead of 'origin/master' by [NUMBER] commits.\n#\nnothing to commit (working directory clean)\n\nand now you want the remote ref 'origin/master' to point to the same\nthing as 'mirror/master' (assuming that you create the ref for the\nmirror)?\n\nThis can be done (by editing the file .git/refs/remotes/origin/master\nand specifying the correct sha1) however this is probably not the best\nidea. It is best for git to know the actual state of the remote the\nlast time you synced with it so that it can act intelligently the next\ntime you sync with it.\n\nIf you intend to sync with the mirror, you might as well set it as the\nupstream ref of you master branch. That way you will not get the 'Your\nbranch is ahead' message when you pull new updates (unless you have\nlocal changes, of course).\nThis can be done by:\n$ git checkout master\n$ git branch --set-upstream mirror\n\nThis assumes that you have already added mirror as a remote ref.\n\nRegards,\nAndrew\n"},{"id":"175741","messageId":"20110918200633.GN15295@mail.gmail.com","threadId":"28419","inReplyTo":"CAH5451m1WJ0H9G8uHbCqZ5acO-xEynGKjMk=6g75buJy1S7iSw@mail.gmail.com","subject":"Re: Pull From Mirrored Repository","fromName":"Jean Sacren","fromEmail":"sakiwit@gmail.com","sentAt":"2011-09-18T20:06:33Z","receivedAt":"2011-09-18T20:06:33Z","isPatch":false,"sender":{"key":"sakiwit@gmail.com","avatar":null},"body":"From: Andrew Ardill <andrew.ardill@gmail.com>\nDate: Mon, 19 Sep 2011 01:15:47 +1000\n>\n> Am I correct in thinking that you have done the following:\n> \n> $ git clone original-server/repo.git\n> $ cd repo\n> $ git pull mirror-server/repo.git\n\nEssentially that's what I did.\n\n> and now you want the remote ref 'origin/master' to point to the same\n> thing as 'mirror/master' (assuming that you create the ref for the\n> mirror)?\n\nThe idea is to update the local tree from multiple sites so long as one\nof them is still running. And the update shall make no difference\nwhether it is from the master site or not.\n\n> This can be done (by editing the file .git/refs/remotes/origin/master\n> and specifying the correct sha1) however this is probably not the best\n> idea. It is best for git to know the actual state of the remote the\n> last time you synced with it so that it can act intelligently the next\n> time you sync with it.\n\nIt turns out to be more of a bug with git. After a successful pull from\na master or mirror site, the SHA1 shall be updated among all the master\nfiles in .git/refs/remotes/origin or .git/refs/remotes/[WHATEVER_MIRROR]\nas the tip of the local tree is updated.\n\n> If you intend to sync with the mirror, you might as well set it as the\n> upstream ref of you master branch. That way you will not get the 'Your\n> branch is ahead' message when you pull new updates (unless you have\n> local changes, of course).\n> This can be done by:\n> $ git checkout master\n> $ git branch --set-upstream mirror\n\nThis is a nice hack, but we want all the changes stay with the master\nbranch. It's easier to use one master branch for tracking all updates\nfrom the upstream.\n\nThank you for all your help!\n\n-- \nJean Sacren\n"}]}