{"thread":{"id":"37193","subject":"confused about remote branch management","startedAt":"2014-07-23T02:49:03Z","lastAt":"2014-07-24T00:24:07Z","messageCount":9,"participants":["Ross Boylan","Chris Packham","Kevin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"246540","messageId":"1406083743.29001.139.camel@localhost","threadId":"37193","inReplyTo":null,"subject":"confused about remote branch management","fromName":"Ross Boylan","fromEmail":"ross@biostat.ucsf.edu","sentAt":"2014-07-23T02:49:03Z","receivedAt":"2014-07-23T02:49:03Z","isPatch":false,"sender":{"key":"ross@biostat.ucsf.edu","avatar":null},"body":"My local master branch is the result of a merge of upstream master and\nsome local changes.  I want to merge in more recent upstream work.\ngit pull doesn't seem to have updated origin/master, and git checkout\norigin/master also doesn't seem to work.\n\nHere's some info that may be relevant.\n\n\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git remote -v\norigin\thttps://github.com/emacs-ess/ESS.git (fetch)\norigin\thttps://github.com/emacs-ess/ESS.git (push)\npersonal\thttps://github.com/RossBoylan/ESS.git (fetch)\npersonal\thttps://github.com/RossBoylan/ESS.git (push)\n# I think I originally cloned from what is now the \"personal\" remote\n# and switched names later so origin refers to upstream.\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -v\n* master 8fa569c [ahead 340] merge from origin\n# 340 ahead of personal is plausible, but ahead from origin seems odd\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git --version\ngit version 1.7.10.4\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -a\n* master\n  remotes/origin/S+eldoc\n  remotes/origin/gretl\n  remotes/origin/linewise_callbacks\n  remotes/origin/litprog\n  remotes/origin/master\n  remotes/origin/transmissions\n  remotes/personal/HEAD -> personal/master\n  remotes/personal/S+eldoc\n  remotes/personal/gretl\n  remotes/personal/linewise_callbacks\n  remotes/personal/litprog\n  remotes/personal/master\n  remotes/personal/transmissions\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n# On branch master\n# Your branch is ahead of 'personal/master' by 340 commits.\n#\nnothing to commit (working directory clean)\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout origin/master\nNote: checking out 'origin/master'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in\nthis\nstate without impacting any branches by performing another checkout.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -b with the checkout command again.\nExample:\n\n  git checkout -b new_branch_name\n\nHEAD is now at a33a2f9... Merge branch 'trunk'\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout master\nPrevious HEAD position was a33a2f9... Merge branch 'trunk'\nSwitched to branch 'master'\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git pull origin master\n# [messages]\nNot committing merge; use 'git commit' to complete the merge.\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n# On branch master\n# Changes to be committed:\n# [long list]\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master\ncommit a33a2f9e06185a225af7d72ea3896cfd260e455e\nMerge: 136742f 6b22a88\nAuthor: Vitalie Spinu <spinuvit@gmail.com>\nDate:   Mon Jan 20 00:43:30 2014 -0800\n\n    Merge branch 'trunk'\n# this was the head of origin/master BEFORE I did the pull.\n# I think this means it has not been updated.\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git commit -m \"merge in\nupstream, probably fe7d609..8fa569c\"\n[master 59f6841] merge in upstream, probably fe7d609..8fa569c\nross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master -v\n# no change\n"},{"id":"246543","messageId":"53CF66D4.7060201@gmail.com","threadId":"37193","inReplyTo":"1406083743.29001.139.camel@localhost","subject":"Re: confused about remote branch management","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2014-07-23T07:40:04Z","receivedAt":"2014-07-23T07:40:04Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 23/07/14 14:49, Ross Boylan wrote:\n> My local master branch is the result of a merge of upstream master and\n> some local changes.  I want to merge in more recent upstream work.\n> git pull doesn't seem to have updated origin/master, and git checkout\n> origin/master also doesn't seem to work.\n> \n> Here's some info that may be relevant.\n> \n> \n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git remote -v\n> origin\thttps://github.com/emacs-ess/ESS.git (fetch)\n> origin\thttps://github.com/emacs-ess/ESS.git (push)\n> personal\thttps://github.com/RossBoylan/ESS.git (fetch)\n> personal\thttps://github.com/RossBoylan/ESS.git (push)\n> # I think I originally cloned from what is now the \"personal\" remote\n> # and switched names later so origin refers to upstream.\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -v\n> * master 8fa569c [ahead 340] merge from origin\n> # 340 ahead of personal is plausible, but ahead from origin seems odd\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git --version\n> git version 1.7.10.4\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -a\n> * master\n>   remotes/origin/S+eldoc\n>   remotes/origin/gretl\n>   remotes/origin/linewise_callbacks\n>   remotes/origin/litprog\n>   remotes/origin/master\n>   remotes/origin/transmissions\n>   remotes/personal/HEAD -> personal/master\n>   remotes/personal/S+eldoc\n>   remotes/personal/gretl\n>   remotes/personal/linewise_callbacks\n>   remotes/personal/litprog\n>   remotes/personal/master\n>   remotes/personal/transmissions\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n> # On branch master\n> # Your branch is ahead of 'personal/master' by 340 commits.\n> #\n> nothing to commit (working directory clean)\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout origin/master\n> Note: checking out 'origin/master'.\n> \n> You are in 'detached HEAD' state. You can look around, make experimental\n> changes and commit them, and you can discard any commits you make in\n> this\n> state without impacting any branches by performing another checkout.\n> \n> If you want to create a new branch to retain commits you create, you may\n> do so (now or later) by using -b with the checkout command again.\n> Example:\n> \n>   git checkout -b new_branch_name\n> \n> HEAD is now at a33a2f9... Merge branch 'trunk'\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout master\n> Previous HEAD position was a33a2f9... Merge branch 'trunk'\n> Switched to branch 'master'\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git pull origin master\n> # [messages]\n> Not committing merge; use 'git commit' to complete the merge.\n\nI think this is the relevant message. By doing a git pull you are asking\nto merge the branch 'master' from the remote 'origin' into the current\nbranch (which happens to also be called 'master').\n\nWhat I'm guessing is in \"# [messages]\" is something about a merge\nconflict that needs resolving before the merge can be completed. There\nare various ways to resolve the conflict but probably the easiest would be\n\n  git mergetool\n  git commit\n\nI personally use have merge.tool set to kdiff3 but there are plenty of\nother options.\n\nAnother option is to abort this attempt and try again (*warning* here be\ndragons).\n\n  git checkout master\n  git reset --hard HEAD\n  git pull\n\nNote: git uses some heuristics to determine what to merge when you don't\nspecify what to pull. This should be origin/master unless\nbranch.master.remote and branch.master.merge are set to something weird.\nThis probably won't do away with the need to resolve your merge\nconflicts but at least you'll be starting from a clean slate.\n\n\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n> # On branch master\n> # Changes to be committed:\n> # [long list]\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master\n> commit a33a2f9e06185a225af7d72ea3896cfd260e455e\n> Merge: 136742f 6b22a88\n> Author: Vitalie Spinu <spinuvit@gmail.com>\n> Date:   Mon Jan 20 00:43:30 2014 -0800\n> \n>     Merge branch 'trunk'\n> # this was the head of origin/master BEFORE I did the pull.\n> # I think this means it has not been updated.\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git commit -m \"merge in\n> upstream, probably fe7d609..8fa569c\"\n> [master 59f6841] merge in upstream, probably fe7d609..8fa569c\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master -v\n> # no change\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"246557","messageId":"CAO54GHDC1rA9hNcAHw0dTcm7Ynu=QRacmnsP9ub09qSP_8NAEg@mail.gmail.com","threadId":"37193","inReplyTo":"1406083743.29001.139.camel@localhost","subject":"Re: confused about remote branch management","fromName":"Kevin","fromEmail":"ikke@ikke.info","sentAt":"2014-07-23T13:30:32Z","receivedAt":"2014-07-23T13:30:32Z","isPatch":false,"sender":{"key":"ikke@ikke.info","avatar":"https://gravatar.com/avatar/60a0d08eeccb16914fdbfc7f3441548dc827dc436d5c6900ec6600e274e53c5b?d=mp&s=160"},"body":"On Jul 23, 2014 5:11 AM, \"Ross Boylan\" <ross@biostat.ucsf.edu> wrote:\n>\n> My local master branch is the result of a merge of upstream master and\n> some local changes.  I want to merge in more recent upstream work.\n> git pull doesn't seem to have updated origin/master, and git checkout\n> origin/master also doesn't seem to work.\n>\n\ngit pull with two parameters in older versions will not update remote\ntracking branches. That's because the last parameter expects a refspec\nwith a source and destination and you only specify a source.\n\nDoing a git fetch will update them.\n\n> ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git --version\n> git version 1.7.10.4\n\nVersion 1.8.4 changes this behavior and will update the remote\ntracking branches.\n"},{"id":"246592","messageId":"1406141641.29001.170.camel@localhost","threadId":"37193","inReplyTo":"CAO54GHBEexASvZcdJqDtgYkfecGbuZFLneC6Nr8u6CYfXuUPog@mail.gmail.com","subject":"Re: confused about remote branch management","fromName":"Ross Boylan","fromEmail":"ross@biostat.ucsf.edu","sentAt":"2014-07-23T18:54:01Z","receivedAt":"2014-07-23T18:54:01Z","isPatch":false,"sender":{"key":"ross@biostat.ucsf.edu","avatar":null},"body":"On Wed, 2014-07-23 at 15:09 +0200, Kevin wrote:\n> \n> On Jul 23, 2014 5:11 AM, \"Ross Boylan\" <ross@biostat.ucsf.edu> wrote:\n> >\n> > My local master branch is the result of a merge of upstream master\n> and\n> > some local changes.  I want to merge in more recent upstream work.\n> > git pull doesn't seem to have updated origin/master, and git\n> checkout\n> > origin/master also doesn't seem to work.\n> >\n> \n> git pull with two parameters in older versions will not update remote\n> tracking branches. That's because the last parameter expects a refspec\n> with a source and destination and you only specify a source. \nMy command was \"git pull origin master\" so I  think it has a source as\nwell.\n> \n> Doing a git fetch will update them. \nI thought git pull = get fetch + git merge.  Are you saying that if I\nissued those 2 commands separately the result would have been different?\nRoss\n> \n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git --version\n> > git version 1.7.10.4\n> \n> Version 1.8.4 changes this behavior and will update the remote\n> tracking branches. \n> \n> \n"},{"id":"246594","messageId":"1406143336.29001.185.camel@localhost","threadId":"37193","inReplyTo":"53CF66D4.7060201@gmail.com","subject":"Re: confused about remote branch management","fromName":"Ross Boylan","fromEmail":"ross@biostat.ucsf.edu","sentAt":"2014-07-23T19:22:16Z","receivedAt":"2014-07-23T19:22:16Z","isPatch":false,"sender":{"key":"ross@biostat.ucsf.edu","avatar":null},"body":"I still don't know what I need to do to update origin/master in my local\nrepo.\n\nRegarding Kevin's suggestion, I just tried \"git fetch origin master\".\nIt seems to have made no difference, at least judging by git show\norigin/master.  I'm assuming the commit it show is  the head of the\nbranch.\n\nFor reasons given below, Chris's theory that there was a conflict also\ndoesn't seem to apply.\n\nOn Wed, 2014-07-23 at 19:40 +1200, Chris Packham wrote:\n> On 23/07/14 14:49, Ross Boylan wrote:\n> > My local master branch is the result of a merge of upstream master and\n> > some local changes.  I want to merge in more recent upstream work.\n> > git pull doesn't seem to have updated origin/master, and git checkout\n> > origin/master also doesn't seem to work.\n> > \n> > Here's some info that may be relevant.\n> > \n> > \n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git remote -v\n> > origin\thttps://github.com/emacs-ess/ESS.git (fetch)\n> > origin\thttps://github.com/emacs-ess/ESS.git (push)\n> > personal\thttps://github.com/RossBoylan/ESS.git (fetch)\n> > personal\thttps://github.com/RossBoylan/ESS.git (push)\n> > # I think I originally cloned from what is now the \"personal\" remote\n> > # and switched names later so origin refers to upstream.\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -v\n> > * master 8fa569c [ahead 340] merge from origin\n> > # 340 ahead of personal is plausible, but ahead from origin seems odd\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git --version\n> > git version 1.7.10.4\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git branch -a\n> > * master\n> >   remotes/origin/S+eldoc\n> >   remotes/origin/gretl\n> >   remotes/origin/linewise_callbacks\n> >   remotes/origin/litprog\n> >   remotes/origin/master\n> >   remotes/origin/transmissions\n> >   remotes/personal/HEAD -> personal/master\n> >   remotes/personal/S+eldoc\n> >   remotes/personal/gretl\n> >   remotes/personal/linewise_callbacks\n> >   remotes/personal/litprog\n> >   remotes/personal/master\n> >   remotes/personal/transmissions\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n> > # On branch master\n> > # Your branch is ahead of 'personal/master' by 340 commits.\n> > #\n> > nothing to commit (working directory clean)\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout origin/master\n> > Note: checking out 'origin/master'.\n> > \n> > You are in 'detached HEAD' state. You can look around, make experimental\n> > changes and commit them, and you can discard any commits you make in\n> > this\n> > state without impacting any branches by performing another checkout.\n> > \n> > If you want to create a new branch to retain commits you create, you may\n> > do so (now or later) by using -b with the checkout command again.\n> > Example:\n> > \n> >   git checkout -b new_branch_name\n> > \n> > HEAD is now at a33a2f9... Merge branch 'trunk'\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git checkout master\n> > Previous HEAD position was a33a2f9... Merge branch 'trunk'\n> > Switched to branch 'master'\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git pull origin master\n> > # [messages]\n> > Not committing merge; use 'git commit' to complete the merge.\n> \n> I think this is the relevant message. By doing a git pull you are asking\n> to merge the branch 'master' from the remote 'origin' into the current\n> branch (which happens to also be called 'master').\n> \n> What I'm guessing is in \"# [messages]\" is something about a merge\n> conflict that needs resolving before the merge can be completed. There\n> are various ways to resolve the conflict but probably the easiest would be\nHere are the full deleted messages:\nremote: Counting objects: 388, done.        \nremote: Compressing objects: 100% (159/159), done.        \nremote: Total 356 (delta 257), reused 289 (delta 190)        \nReceiving objects: 100% (356/356), 59.99 KiB, done.\nResolving deltas: 100% (257/257), completed with 29 local objects.\nFrom https://github.com/emacs-ess/ESS\n * branch            master     -> FETCH_HEAD\nerror: Terminal is dumb, but EDITOR unset\nNot committing merge; use 'git commit' to complete the merge.\n\nSo the lack of commit was not from a conflict, just it didn't know how\nto bring up an editor (I was in a bash  session under emacs).\n\n[snip discussion of merging]\n> \n> \n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git status\n> > # On branch master\n> > # Changes to be committed:\n> > # [long list]\nThe list had only modified and added files; no conflicts.\n\nRoss\n\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master\n> > commit a33a2f9e06185a225af7d72ea3896cfd260e455e\n> > Merge: 136742f 6b22a88\n> > Author: Vitalie Spinu <spinuvit@gmail.com>\n> > Date:   Mon Jan 20 00:43:30 2014 -0800\n> > \n> >     Merge branch 'trunk'\n> > # this was the head of origin/master BEFORE I did the pull.\n> > # I think this means it has not been updated.\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git commit -m \"merge in\n> > upstream, probably fe7d609..8fa569c\"\n> > [master 59f6841] merge in upstream, probably fe7d609..8fa569c\n> > ross@tempserver:~/UCSF/Choi/GitHub/ESS$ git show origin/master -v\n> > # no change\n"},{"id":"246611","messageId":"xmqqmwbzda80.fsf@gitster.dls.corp.google.com","threadId":"37193","inReplyTo":"1406143336.29001.185.camel@localhost","subject":"Re: confused about remote branch management","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-07-23T21:41:19Z","receivedAt":"2014-07-23T21:41:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross Boylan <ross@biostat.ucsf.edu> writes:\n\n> I still don't know what I need to do to update origin/master in my local\n> repo.\n>\n> Regarding Kevin's suggestion, I just tried \"git fetch origin master\".\n\nI think Kevin's suggestion was 'To older git, \"git fetch origin\nmaster\" tells it to fetch master without updating origin/master, so\nit is understandable that your origin/master was not molested'.\n\nEither\n\n\tgit fetch origin master:refs/remotes/origin/master\n\nor if you want to be more explicit and unambiguous:\n\n\tgit fetch origin refs/heads/master:refs/remotes/origin/master\n\nshould work on all versions of git.\n"},{"id":"246623","messageId":"1406158252.29001.223.camel@localhost","threadId":"37193","inReplyTo":"xmqqmwbzda80.fsf@gitster.dls.corp.google.com","subject":"Re: confused about remote branch management","fromName":"Ross Boylan","fromEmail":"ross@biostat.ucsf.edu","sentAt":"2014-07-23T23:30:52Z","receivedAt":"2014-07-23T23:30:52Z","isPatch":false,"sender":{"key":"ross@biostat.ucsf.edu","avatar":null},"body":"On Wed, 2014-07-23 at 14:41 -0700, Junio C Hamano wrote:\n> Ross Boylan <ross@biostat.ucsf.edu> writes:\n> \n> > I still don't know what I need to do to update origin/master in my local\n> > repo.\n> >\n> > Regarding Kevin's suggestion, I just tried \"git fetch origin master\".\n> \n> I think Kevin's suggestion was 'To older git, \"git fetch origin\n> master\" tells it to fetch master without updating origin/master, so\n> it is understandable that your origin/master was not molested'.\n> \n> Either\n> \n> \tgit fetch origin master:refs/remotes/origin/master\nGreat; that works.\nIs that procedure supposed to be the usual way I track upstream in this\n(1.7) version of git?  It seems arcane.\n\nI had thought the usual workflow was supposed to be one of 2\nalternatives, either\ngit checkout remotes/origin/master\ngit pull origin master\ngit checkout master\ngit merge remotes/origin/master\nBut that failed on the first step.  Or\n\n# assuming we are on the local master branch\ngit fetch origin master\n# and everything is updated.\n\nIs the problem that I called the local branch with my modifications\nmaster instead of something else?\n> \n> or if you want to be more explicit and unambiguous:\n> \n> \tgit fetch origin refs/heads/master:refs/remotes/origin/master\n> \n> should work on all versions of git.\n\nAfter studying man git-fetch's discussion of the refspec parameter,\nespecially the second note: \n\n\tYou never do your own development on branches that appear on the right\nhand side of a <refspec> colon on Pull: lines; they are to be updated by\ngit fetch. If you intend to do development derived from a remote branch\nB, have a Pull: line to track it (i.e. Pull: B:remote-B), and have a\nseparate branch my-B to do your development on top of it. The latter is\ncreated by git branch my-B remote-B (or its equivalent git checkout -b\nmy-B remote-B). Run git fetch to keep track of the progress of the\nremote side, and when you see something new on the remote branch, merge\nit into your development branch with git pull . remote-B, while you are\non my-B branch.\n\nI'm even more confused.  Is \"Pull: lines\" a reference to log messages\nduring the fetch, a configuration file, or something else?  The docs\nrefer to a pull: line in $GIT_DIR/remotes, but I have no such directory.\nI do have .git/config, which includes\n[remote \"personal\"]\n\turl = https://github.com/RossBoylan/ESS.git\n\tfetch = +refs/heads/*:refs/remotes/personal/*\n[branch \"master\"]\n\tremote = personal\n\tmerge = refs/heads/master\n[remote \"origin\"]\n\turl = https://github.com/emacs-ess/ESS.git\n\tfetch = +refs/heads/*:refs/remotes/origin/*\n\nAh!  branch master is associated with the personal remote; is that why\nupdating it from origin's master branch has no effect on origin/master?\n\nI also don't know what the \".\" in \"git pull . remote-B\" does; the\ngit-pull manpage doesn't indicate it's legal as far as I can see.\n\nRoss\n"},{"id":"246624","messageId":"xmqqvbqnab1n.fsf@gitster.dls.corp.google.com","threadId":"37193","inReplyTo":"1406158252.29001.223.camel@localhost","subject":"Re: confused about remote branch management","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-07-23T23:51:48Z","receivedAt":"2014-07-23T23:51:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross Boylan <ross@biostat.ucsf.edu> writes:\n\n>> Either\n>> \n>> \tgit fetch origin master:refs/remotes/origin/master\n> Great; that works.\n> Is that procedure supposed to be the usual way I track upstream in this\n> (1.7) version of git?  It seems arcane.\n\nNo, and no.  The command is designed so that most of the time you\ncan just say \"git fetch<ENTER>\" without anything extra, which will\nlet the configured remote.*.fetch to kick in as the default refspec\nto slurp updates to all the branches.  This is because the branches\nof a single project are supposed to be related, and a single \"git\nfetch\" goes over a single network connection, establishment of which\nis expected to be a large overhead.  Letting a single invocation of\n\"fetch\" to slurp updates to _all_ the branches is supposed not to be\ntoo much overhead over grabbing updates to everything (let alone\ninvoking a \"git fetch\" per each individual branch), and is the\nnormal mode of operation.\n\nA single-shot \"git fetch origin master\" to explicitly decline\nfollowing of everything other than 'master' *is* the special case.\n\nAnd it was a very conscious design decision not to molest the remote\ntracking branch when this kind of explicit command line request is\nmade, so that you do not lose track of what commit you _saw_ before\nyou ran the command.  That way \"git log origin/master..FETCH_HEAD\"\ncan be used to inspect what got changed since you fetched last time.\n\nOver the years, with reflogs enabled for everybody, preserving the\nremote tracking branches when the user does not explicitly ask to\nstore the result has become much less important.  For this reason,\nmodern Git applies, when it sees \"git fetch origin master\", the\nconfigured remote.*.fetch as refmap to map the name \"master\",\ni.e. the only branch you are fetching, to the remote tracking branch\nyou use to store the result, i.e. \"refs/remotes/origin/master\".\n"},{"id":"246625","messageId":"1406161447.29001.235.camel@localhost","threadId":"37193","inReplyTo":"xmqqvbqnab1n.fsf@gitster.dls.corp.google.com","subject":"Re: confused about remote branch management","fromName":"Ross Boylan","fromEmail":"ross@biostat.ucsf.edu","sentAt":"2014-07-24T00:24:07Z","receivedAt":"2014-07-24T00:24:07Z","isPatch":false,"sender":{"key":"ross@biostat.ucsf.edu","avatar":null},"body":"On Wed, 2014-07-23 at 16:51 -0700, Junio C Hamano wrote:\n> Ross Boylan <ross@biostat.ucsf.edu> writes:\n> \n> >> Either\n> >> \n> >> \tgit fetch origin master:refs/remotes/origin/master\n> > Great; that works.\n> > Is that procedure supposed to be the usual way I track upstream in this\n> > (1.7) version of git?  It seems arcane.\n> \n> No, and no.  \nGood.  How should I handle getting updates from origin?\n> The command is designed so that most of the time you\n> can just say \"git fetch<ENTER>\" without anything extra, which will\n> let the configured remote.*.fetch to kick in as the default refspec\n> to slurp updates to all the branches.  This is because the branches\n> of a single project are supposed to be related, and a single \"git\n> fetch\" goes over a single network connection, establishment of which\n> is expected to be a large overhead.  Letting a single invocation of\n> \"fetch\" to slurp updates to _all_ the branches is supposed not to be\n> too much overhead over grabbing updates to everything (let alone\n> invoking a \"git fetch\" per each individual branch), and is the\n> normal mode of operation.\n> \n> A single-shot \"git fetch origin master\" to explicitly decline\n> following of everything other than 'master' *is* the special case.\n> \n> And it was a very conscious design decision not to molest the remote\n> tracking branch when this kind of explicit command line request is\n> made, so that you do not lose track of what commit you _saw_ before\n> you ran the command.  That way \"git log origin/master..FETCH_HEAD\"\n> can be used to inspect what got changed since you fetched last time.\n> \n> Over the years, with reflogs enabled for everybody, preserving the\n> remote tracking branches when the user does not explicitly ask to\n> store the result has become much less important.  For this reason,\n> modern Git applies, when it sees \"git fetch origin master\", the\n> configured remote.*.fetch as refmap to map the name \"master\",\n> i.e. the only branch you are fetching, to the remote tracking branch\n> you use to store the result, i.e. \"refs/remotes/origin/master\".\n\nFor this case I think \"get fetch\" will attempt to retrieve from the\n\"personal\" remote.\n\nWill \"get fetch origin\" (with no other arguments) update all the\nbranches in origin, updating the remote tracking branches, particularly\nin git 1.7?  \n\nWhen I tried \"git fetch origin\" nothing happened (it returned\nimmediately with  no messages and git branch -v -a showed the same heads\nas before).  It's quite possible none of the other branches have changed\nsince I last got them, so I don't think the exercise proves much.\n\nRoss\n"}]}