{"thread":{"id":"6363","subject":"1.5.0.rc1.gb60d: fetch in another branch works strangely","startedAt":"2007-01-13T21:06:11Z","lastAt":"2007-01-13T21:46:15Z","messageCount":3,"participants":["Horst H. von Brand","Shawn O. Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"31653","messageId":"200701132106.l0DL6BPH008314@laptop13.inf.utfsm.cl","threadId":"6363","inReplyTo":null,"subject":"1.5.0.rc1.gb60d: fetch in another branch works strangely","fromName":"Horst H. von Brand","fromEmail":"vonbrand@inf.utfsm.cl","sentAt":"2007-01-13T21:06:11Z","receivedAt":"2007-01-13T21:06:11Z","isPatch":false,"sender":{"key":"vonbrand@inf.utfsm.cl","avatar":"https://avatars.githubusercontent.com/u/211384?v=4"},"body":"I created a new branch in the kernel to carry a not yet official patch, to\nkeep this up to date I do:\n\n   $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n   $ git pull . origin\n\nThe kernel repository is quite old, so it has the old-fashoned setup. I\nsee:\n\n  $ less .git/refs/heads/bz-7795 \n  d132ed980aee1bdcc6fa02b91da95a357902eb3c\n  $ less .git/refs/heads/origin  \n  d39c9400ae0d60aaaf534b1ad860a9bc1413d8af\n\nAnd this last ref doesn't change when fetching.\n\nStrangely, each time I fetch it gets 7 new objects (I haven't pulled, I do\nthat once I'm sure I've got all). As I tend to doubt that we are /that/\nsyncronized with Linus, something fishy is going on here...\n\nFirst noticed this with 1.5.0.rc1.g4494.\n-- \nDr. Horst H. von Brand                   User #22616 counter.li.org\nDepartamento de Informatica                    Fono: +56 32 2654431\nUniversidad Tecnica Federico Santa Maria             +56 32 2654239\nCasilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513\n"},{"id":"31654","messageId":"20070113211428.GA17749@spearce.org","threadId":"6363","inReplyTo":"200701132106.l0DL6BPH008314@laptop13.inf.utfsm.cl","subject":"Re: 1.5.0.rc1.gb60d: fetch in another branch works strangely","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-01-13T21:14:28Z","receivedAt":"2007-01-13T21:14:28Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Horst H. von Brand\" <vonbrand@inf.utfsm.cl> wrote:\n> I created a new branch in the kernel to carry a not yet official patch, to\n> keep this up to date I do:\n> \n>    $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n\nThat's only writing into FETCH_HEAD whatever branch is marked as\nHEAD in Linus' repository.  No local refs are being updated.\n\n>    $ git pull . origin\n\nSo this won't merge in the changes fetched above.\n\n\nWhy not setup that URL as a remote (git remote add linus ....)\nThen you can do:\n\n  $ git fetch linus\n  $ git merge linus/master\n\nor \n\n  $ git fetch linus\n  $ git pull . linus/master\n\nor \n\n  $ git pull linus master\n\n-- \nShawn.\n"},{"id":"31656","messageId":"7vr6tyk3bs.fsf@assigned-by-dhcp.cox.net","threadId":"6363","inReplyTo":"200701132106.l0DL6BPH008314@laptop13.inf.utfsm.cl","subject":"Re: 1.5.0.rc1.gb60d: fetch in another branch works strangely","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-13T21:46:15Z","receivedAt":"2007-01-13T21:46:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Horst H. von Brand\" <vonbrand@inf.utfsm.cl> writes:\n\n> I created a new branch in the kernel to carry a not yet official patch, to\n> keep this up to date I do:\n>\n>    $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n\nIf you use longhand without colon-refspec (src:dst), then the fetch\nresult will be in temporary ref, FETCH_HEAD.  (google, or gmane\nsearch for a message on \"temporary ref\" and \"FETCH_HEAD\" by\nLinus for gory details).  So next fetch will keep re-fetching\nthe same thing (this has been how \"fetch\" was designed to work\nfrom day one and there is nothing new).\n\n>    $ git pull . origin\n\nYou do not have origin tracking branch (well, you do -have- one,\nbut by doing the longhand without colon-refspec, you choose not\nto keep it up-to-date), so that would try to merge an ancient\ncopy you obtained probably when you cloned to create the\nrepository.\n\nYou either can do:\n\n (1) Ad-hoc promiscuous pull without using tracking branch\n\n     $ git pull git://git.kernel.org/...../linux-2.6.git\n\n     This is good for one-shot pulling from random place when\n     you notice somebody you usually do not interact with has\n     something interesting.  I do not think you would want to do\n     that with Linus.\n\n (2) Use remote shorthand, define and maintain tracking branch(es).\n\n     In the traditional configuration,\n     you would have .git/remotes/origin that says something\n     like:\n\n\tURL: git://git.kernel.org/...../torvalds/linux-2.6.git\n\tPull: refs/heads/master:refs/heads/origin\n\n     With the newer configuration, the moral equivalent is found\n     in your .git/config file and would look like something like\n     this:\n\n\t[remote \"origin\"]\n        \turl = git://git.kernel.org/...../linux-2.6.git/\n\t\tfetch = +refs/heads/*:refs/remotes/origin/*\n\t[branch \"master\"]\n        \tmerge = refs/heads/master\n\n     In either way, you can update the tracking branch with:\n\n     $ git fetch origin ;# or just \"git fetch\"\n\n     With this, since you -do- have and -maintain- the tracking\n     branch, you can do after this \"git fetch\":\n\n     $ git merge origin\n\n     to merge in what you have fetched.\n"}]}