{"thread":{"id":"19343","subject":"how to update origin/<branch> after a push to origin <branch>?","startedAt":"2009-05-14T04:42:15Z","lastAt":"2009-05-14T05:29:49Z","messageCount":6,"participants":["layer","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"113869","messageId":"19640.1242276135@relay.known.net","threadId":"19343","inReplyTo":null,"subject":"how to update origin/<branch> after a push to origin <branch>?","fromName":"layer","fromEmail":"layer@known.net","sentAt":"2009-05-14T04:42:15Z","receivedAt":"2009-05-14T04:42:15Z","isPatch":false,"sender":{"key":"layer@known.net","avatar":null},"body":"I'm stumped on this one.\n\nI'm in a repo and I push the master branch.  If I do\n\n  git diff --name-only origin/master..master\n\nafter the push, I still see the names of the files I pushed because I\nhaven't updated origin/master yet, with a fetch.  Of course, a \"git\npull\" would do it, but I don't want to do that, because I might be\nusing something other than `origin' and I don't want anything but the\nsingle branch.\n\nSo, I naively thought that\n\n  git fetch origin master\n\nwould do the trick, but after that command the git diff above still\nshows the same files.\n\nTo make matters worse (!!), I made this attempt:\n\n  $ git fetch origin master:origin/master\n  From git:/repo/git/acl\n   * [new branch]      master     -> origin/master\n  $ git diff origin/master..master\n  warning: refname 'origin/master' is ambiguous.\n  $ \n\nUh oh.\n\n  $ git branch -a | grep origin/master\n    origin/master\n    origin/master\n  $ find .git/refs -type f | grep origin\n  .git/refs/heads/origin/master\n  .git/refs/remotes/origin/acl81\n  .git/refs/remotes/origin/HEAD\n  .git/refs/remotes/origin/master\n  $ cat .git/refs/heads/origin/master\n  28f0f4f2cdf37640b94cdbd65406898222593f28\n  $ cat .git/refs/remotes/origin/master\n  4be7cc89d335421a93e4551b40bd06108a030221\n  $ \n\n\nI'm going to leave my repo as is until a professionals helps me out,\nlest I dig the hole deeper.\n\nThanks.\n\nKevin\n"},{"id":"113872","messageId":"32541b130905132158s44cc5b19n974901c05cf025b2@mail.gmail.com","threadId":"19343","inReplyTo":"19640.1242276135@relay.known.net","subject":"Re: how to update origin/<branch> after a push to origin <branch>?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-05-14T04:58:09Z","receivedAt":"2009-05-14T04:58:09Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Thu, May 14, 2009 at 12:42 AM, layer <layer@known.net> wrote:\n> after the push, I still see the names of the files I pushed because I\n> haven't updated origin/master yet, with a fetch.  Of course, a \"git\n> pull\" would do it, but I don't want to do that, because I might be\n> using something other than `origin' and I don't want anything but the\n> single branch.\n>\n> So, I naively thought that\n>\n>  git fetch origin master\n>\n> would do the trick, but after that command the git diff above still\n> shows the same files.\n\nShort answer:\n\n   git fetch origin\n\nHowever, 'git push origin master' should update origin/master\nautomatically, at least in relatively recent git versions.  It's\nrather weird if that didn't happen.\n\nHave fun,\n\nAvery\n"},{"id":"113873","messageId":"19997.1242277316@relay.known.net","threadId":"19343","inReplyTo":"32541b130905132158s44cc5b19n974901c05cf025b2@mail.gmail.com","subject":"Re: how to update origin/<branch> after a push to origin <branch>?","fromName":"layer","fromEmail":"layer@known.net","sentAt":"2009-05-14T05:01:56Z","receivedAt":"2009-05-14T05:01:56Z","isPatch":false,"sender":{"key":"layer@known.net","avatar":null},"body":"Avery Pennarun <apenwarr@gmail.com> wrote:\n\n>> On Thu, May 14, 2009 at 12:42 AM, layer <layer@known.net> wrote:\n>> > after the push, I still see the names of the files I pushed because I\n>> > haven't updated origin/master yet, with a fetch.  Of course, a \"git\n>> > pull\" would do it, but I don't want to do that, because I might be\n>> > using something other than `origin' and I don't want anything but the\n>> > single branch.\n>> >\n>> > So, I naively thought that\n>> >\n>> >  git fetch origin master\n>> >\n>> > would do the trick, but after that command the git diff above still\n>> > shows the same files.\n>> \n>> Short answer:\n>> \n>>    git fetch origin\n\nI'm pretty sure I tried that.  I'll certainly verify it once I figure\nout how to unwedge my repo.\n\n>> However, 'git push origin master' should update origin/master\n>> automatically, at least in relatively recent git versions.  It's\n>> rather weird if that didn't happen.\n\nThat's what I thought.  Using git version 1.6.1.3 (client and server\nare the same machine).\n"},{"id":"113875","messageId":"20189.1242278012@relay.known.net","threadId":"19343","inReplyTo":"32541b130905132158s44cc5b19n974901c05cf025b2@mail.gmail.com","subject":"Re: how to update origin/<branch> after a push to origin <branch>?","fromName":"layer","fromEmail":"layer@known.net","sentAt":"2009-05-14T05:13:32Z","receivedAt":"2009-05-14T05:13:32Z","isPatch":false,"sender":{"key":"layer@known.net","avatar":null},"body":"Avery Pennarun <apenwarr@gmail.com> wrote:\n\n>> On Thu, May 14, 2009 at 12:42 AM, layer <layer@known.net> wrote:\n>> > after the push, I still see the names of the files I pushed because I\n>> > haven't updated origin/master yet, with a fetch.  Of course, a \"git\n>> > pull\" would do it, but I don't want to do that, because I might be\n>> > using something other than `origin' and I don't want anything but the\n>> > single branch.\n>> >\n>> > So, I naively thought that\n>> >\n>> >  git fetch origin master\n>> >\n>> > would do the trick, but after that command the git diff above still\n>> > shows the same files.\n>> \n>> Short answer:\n>> \n>>    git fetch origin\n>> \n>> However, 'git push origin master' should update origin/master\n>> automatically, at least in relatively recent git versions.  It's\n>> rather weird if that didn't happen.\n\nI decided to attempt cleanup myself:\n\n  $ mv .git/refs/heads/origin/ git.refs.heads.origin\n  $ git diff origin/master..master\n  diff --git a/ChangeLog b/ChangeLog\n  index f7b4551..f2200a0 100644\n  --- a/ChangeLog\n  +++ b/ChangeLog\n  ...\n\nOK, back to normal.\n\n  $ git fetch origin\n  From git:/repo/git/acl\n     4be7cc8..28f0f4f  master     -> origin/master\n  $ git diff origin/master..master\n  $ \n\n\nI _swear_ I tried that.  <sigh>  Sorry to trouble everyone, and thanks\nAvery.  Appreciated.\n\nKevin\n"},{"id":"113878","messageId":"20329.1242278469@relay.known.net","threadId":"19343","inReplyTo":"32541b130905132158s44cc5b19n974901c05cf025b2@mail.gmail.com","subject":"Re: how to update origin/<branch> after a push to origin <branch>?","fromName":"layer","fromEmail":"layer@known.net","sentAt":"2009-05-14T05:21:09Z","receivedAt":"2009-05-14T05:21:09Z","isPatch":false,"sender":{"key":"layer@known.net","avatar":null},"body":"Avery Pennarun <apenwarr@gmail.com> wrote:\n\n>> Short answer:\n>> \n>>    git fetch origin\n\nI wasn't doing exactly this, but I was doing the equivalent of \n\n  git fetch $(git config --get remote.origin.url)\n\nWhy would these be different?\n\nKevin\n"},{"id":"113881","messageId":"32541b130905132229nf873a39m4b7c93e3bac0f39c@mail.gmail.com","threadId":"19343","inReplyTo":"20329.1242278469@relay.known.net","subject":"Re: how to update origin/<branch> after a push to origin <branch>?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-05-14T05:29:49Z","receivedAt":"2009-05-14T05:29:49Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Thu, May 14, 2009 at 1:21 AM, layer <layer@known.net> wrote:\n> Avery Pennarun <apenwarr@gmail.com> wrote:\n>>> Short answer:\n>>>\n>>>    git fetch origin\n>\n> I wasn't doing exactly this, but I was doing the equivalent of\n>\n>  git fetch $(git config --get remote.origin.url)\n>\n> Why would these be different?\n\nIf you fetch only based on URL, then git doesn't know the name of that\nurl is 'origin', and thus can't possibly know that it's supposed to\nreplace origin/master.\n\nBTW, the reason 'git fetch origin master' doesn't work is completely\nunrelated: in *that* case, that syntax means you want to fetch the\nbranch named master, but you're going to do something specific to it,\nso it ends up being stored as FETCH_HEAD instead.  Generally you don't\nwant to use that syntax.\n\nAvery\n"}]}