{"thread":{"id":"21617","subject":"Question about \"git pull --rebase\"","startedAt":"2009-11-14T20:39:24Z","lastAt":"2009-11-16T12:17:51Z","messageCount":10,"participants":["Francis Moreau","Nanako Shiraishi","Johan 't Hart","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127557","messageId":"38b2ab8a0911141239w2bab7277o66350bc742d985dd@mail.gmail.com","threadId":"21617","inReplyTo":null,"subject":"Question about \"git pull --rebase\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-11-14T20:39:24Z","receivedAt":"2009-11-14T20:39:24Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"hello,\n\nLet's say I'm on a branch called 'foo'.\n\nI tried to rebase this branch by using 'git pull --rebase'.\n\nI first tried the following command:\n\n    $ git pull --rebase origin master:foo\n    remote: Counting objects: 5, done.\n    remote: Total 3 (delta 0), reused 0 (delta 0)\n    Unpacking objects: 100% (3/3), done.\n    From /dev/shm/git/A\n    ! [rejected]        master     -> foo  (non fast forward)\n\nwhich failed.\n\nThen I tried:\n\n    $ git pull --rebase origin master\n\nwhich worked.\n\nReading the man git-pull I would assume the 2 commands are equivalent\nbut obviously they're not.\n\nSo the question is: why ?\n\nThanks\n-- \nFrancis\n"},{"id":"127567","messageId":"20091115081649.6117@nanako3.lavabit.com","threadId":"21617","inReplyTo":"38b2ab8a0911141239w2bab7277o66350bc742d985dd@mail.gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-11-14T23:16:49Z","receivedAt":"2009-11-14T23:16:49Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Francis Moreau <francis.moro@gmail.com>\n\n> Let's say I'm on a branch called 'foo'.\n> ...\n>     $ git pull --rebase origin master:foo\n\nWith this command line, you are asking:\n\n 1) Please first fetch master from origin and update the local \n    'foo' with it, but please fail if this doesn't fast forward;\n\n 2) If the first step was successful, please rebase the current \n    branch on top of that commit.\n\nIf your current branch 'foo' doesn't fast forward, the first step \nshould fail, and that is the failure you saw.\n\nYour request doesn't make any sense. The first step would succeed \nonly when your 'foo' doesn't have anything to replay on 'master' \nfrom origin, and the second step either isn't executed (when 'foo' \nhas some commits), or it doesn't do anything (when 'foo' doesn't \nhave any commit).\n\n>     $ git pull --rebase origin master\n\nWith this command line, you are asking:\n\n 1) Please first fetch master from origin, but don't store it anywhere;\n\n 2) Then on top of that fetched commit, please rebase the current branch.\n\nThat is a much saner request.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"127568","messageId":"4AFF3D4D.7000308@gmail.com","threadId":"21617","inReplyTo":"38b2ab8a0911141239w2bab7277o66350bc742d985dd@mail.gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Johan 't Hart","fromEmail":"johanthart@gmail.com","sentAt":"2009-11-14T23:29:17Z","receivedAt":"2009-11-14T23:29:17Z","isPatch":false,"sender":{"key":"johanthart@gmail.com","avatar":"https://gravatar.com/avatar/f7bd2928a1a23e971f4ab68a6c7b35d7ff0efb1c225c570430badf90e404e50b?d=mp&s=160"},"body":"Francis Moreau schreef:\n > hello,\n >\n > Let's say I'm on a branch called 'foo'.\n >\n > I tried to rebase this branch by using 'git pull --rebase'.\n >\n > I first tried the following command:\n >\n >     $ git pull --rebase origin master:foo\n >     remote: Counting objects: 5, done.\n >     remote: Total 3 (delta 0), reused 0 (delta 0)\n >     Unpacking objects: 100% (3/3), done.\n >     From /dev/shm/git/A\n >     ! [rejected]        master     -> foo  (non fast forward)\n\nWhen using a refspec, you usually mean to update a remote tracking \nbranch, like refs/remotes/origin/master. Internally the refspec \nparameter is passed to git fetch, which fast-forwards your local \ntracking branch to match the remote branch.\n\nWith this command, you make git clear you want to fast-forward your \nbranch refs/foo to match the remotes master branch, and then rebase your \n  current branch on that foo branch.\n\nFoo probably is also your current branch. So what you probably want is \nto fetch the remotes master branch and rebase your current branch foo on \nit. You could do it this way:\n\n > Then I tried:\n >\n >     $ git pull --rebase origin master\n >\n > which worked.\n\nThis does not update any remote tracking branches, but it will rebase \nyour foo branch on the remote master branch (which is what you want)\nIt could also be done with:\n\ngit pull --rebase origin master:origin/master\n\nThis will also update your remote tracking branch \nrefs/remotes/origin/master to match the master branch on the remote \nrepo. Your foo branch will then be rebased onto it.\n\n >\n > Reading the man git-pull I would assume the 2 commands are equivalent\n > but obviously they're not.\n >\n > So the question is: why ?\n\nSo, thats why :) They're not the same. Many words... Hope you \nunderstand... I hope I understood it well too..?\n\n >\n > Thanks\n"},{"id":"127614","messageId":"m2r5rzoo5x.fsf@gmail.com","threadId":"21617","inReplyTo":"20091115081649.6117@nanako3.lavabit.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-11-15T14:31:06Z","receivedAt":"2009-11-15T14:31:06Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Francis Moreau <francis.moro@gmail.com>\n>\n>> Let's say I'm on a branch called 'foo'.\n>> ...\n>>     $ git pull --rebase origin master:foo\n>\n> With this command line, you are asking:\n>\n>  1) Please first fetch master from origin and update the local \n>     'foo' with it, but please fail if this doesn't fast forward;\n>\n>  2) If the first step was successful, please rebase the current \n>     branch on top of that commit.\n>\n> If your current branch 'foo' doesn't fast forward, the first step \n> should fail, and that is the failure you saw.\n>\n> Your request doesn't make any sense. The first step would succeed \n> only when your 'foo' doesn't have anything to replay on 'master' \n> from origin, and the second step either isn't executed (when 'foo' \n> has some commits), or it doesn't do anything (when 'foo' doesn't \n> have any commit).\n>\n>>     $ git pull --rebase origin master\n>\n> With this command line, you are asking:\n>\n>  1) Please first fetch master from origin, but don't store it anywhere;\n>\n>  2) Then on top of that fetched commit, please rebase the current branch.\n>\n> That is a much saner request.\n\nI see thanks.\n\nActually I've been confused by the following part of the git-pull man\npage:\n\n    A parameter <ref> without a colon is equivalent to <ref>: when\n    pulling/fetching, so it merges <ref> into the current branch without\n    storing the remote branch anywhere locally\n\nSo it sounds that both of the pull commands were equivalent whereas\nthey're not.\n\n-- \nFrancis\n"},{"id":"127615","messageId":"m2my2noo0g.fsf@gmail.com","threadId":"21617","inReplyTo":"4AFF3D4D.7000308@gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-11-15T14:34:23Z","receivedAt":"2009-11-15T14:34:23Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Johan 't Hart <johanthart@gmail.com> writes:\n\n> Francis Moreau schreef:\n>> hello,\n>>\n>> Let's say I'm on a branch called 'foo'.\n>>\n>> I tried to rebase this branch by using 'git pull --rebase'.\n>>\n>> I first tried the following command:\n>>\n>>     $ git pull --rebase origin master:foo\n>>     remote: Counting objects: 5, done.\n>>     remote: Total 3 (delta 0), reused 0 (delta 0)\n>>     Unpacking objects: 100% (3/3), done.\n>>     From /dev/shm/git/A\n>>     ! [rejected]        master     -> foo  (non fast forward)\n>\n> When using a refspec, you usually mean to update a remote tracking\n> branch, like refs/remotes/origin/master. Internally the refspec\n> parameter is passed to git fetch, which fast-forwards your local\n> tracking branch to match the remote branch.\n>\n> With this command, you make git clear you want to fast-forward your\n> branch refs/foo to match the remotes master branch, and then rebase\n> your current branch on that foo branch.\n>\n> Foo probably is also your current branch. So what you probably want is\n> to fetch the remotes master branch and rebase your current branch foo\n> on it. You could do it this way:\n>\n>> Then I tried:\n>>\n>>     $ git pull --rebase origin master\n>>\n>> which worked.\n>\n> This does not update any remote tracking branches, but it will rebase\n> your foo branch on the remote master branch (which is what you want)\n> It could also be done with:\n>\n> git pull --rebase origin master:origin/master\n>\n> This will also update your remote tracking branch\n> refs/remotes/origin/master to match the master branch on the remote\n> repo. Your foo branch will then be rebased onto it.\n>\n>>\n>> Reading the man git-pull I would assume the 2 commands are equivalent\n>> but obviously they're not.\n>>\n>> So the question is: why ?\n>\n> So, thats why :) They're not the same. Many words... Hope you\n> understand... I hope I understood it well too..?\n>\n\nLooks like you did :)\n\nI've been somehow confused by the git-pull man page, which says:\n\n  A parameter <ref> without a colon is equivalent to <ref>: when\n  pulling/fetching, so it merges <ref> into the current branch without\n  storing the remote branch anywhere locally\n\nSo I thought that both of the commands were equivalent for 'git pull\n--rebase'.\n\nThanks for the explanation.\n-- \nFrancis\n"},{"id":"127628","messageId":"4B005AEC.1000002@gmail.com","threadId":"21617","inReplyTo":"m2my2noo0g.fsf@gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Johan 't Hart","fromEmail":"johanthart@gmail.com","sentAt":"2009-11-15T19:47:56Z","receivedAt":"2009-11-15T19:47:56Z","isPatch":false,"sender":{"key":"johanthart@gmail.com","avatar":"https://gravatar.com/avatar/f7bd2928a1a23e971f4ab68a6c7b35d7ff0efb1c225c570430badf90e404e50b?d=mp&s=160"},"body":"Francis Moreau schreef:\n> Looks like you did :)\n> \n> I've been somehow confused by the git-pull man page, which says:\n> \n>   A parameter <ref> without a colon is equivalent to <ref>: when\n>   pulling/fetching, so it merges <ref> into the current branch without\n>   storing the remote branch anywhere locally\n> \n> So I thought that both of the commands were equivalent for 'git pull\n> --rebase'.\n> \n> Thanks for the explanation.\n\nAh that part.\n\nIt means that\n$ git pull --rebase origin master\n\nmeans the same as:\n$ git pull --rebase origin master:\n(note extra colon at the end)\n\nBut not as:\n$ git pull --rebase origin master:foo\n\nIt means that, when you give a refspec without a colon, it is the same \nas the refspec with the colon and without the right side.\n"},{"id":"127630","messageId":"7vlji7k0dm.fsf@alter.siamese.dyndns.org","threadId":"21617","inReplyTo":"4B005AEC.1000002@gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-15T20:18:29Z","receivedAt":"2009-11-15T20:18:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johan 't Hart <johanthart@gmail.com> writes:\n\n> Francis Moreau schreef:\n>> Looks like you did :)\n>>\n>> I've been somehow confused by the git-pull man page, which says:\n>>\n>>   A parameter <ref> without a colon is equivalent to <ref>: when\n>>   pulling/fetching, so it merges <ref> into the current branch without\n>>   storing the remote branch anywhere locally\n>>\n>> So I thought that both of the commands were equivalent for 'git pull\n>> --rebase'.\n>>\n>> Thanks for the explanation.\n>\n> Ah that part.\n>\n> It means that\n> $ git pull --rebase origin master\n>\n> means the same as:\n> $ git pull --rebase origin master:\n> (note extra colon at the end)\n>\n> But not as:\n> $ git pull --rebase origin master:foo\n>\n> It means that, when you give a refspec without a colon, it is the same\n> as the refspec with the colon and without the right side.\n\nThanks for clearing it up.\n\nI was puzzled by the above pointing-finger because I wanted to see where a\nmisinformation originated from to fix it at the source.  But still don't\nsee anything wrong with it.\n\nPerhaps there was some other part of the manual that confused Francis to\nthink master: and master:foo are equivalent in that context?  I somehow\ndoubt it, but if there is one, we would need to fix that\n\nIn a separate thread, Thomas reported a gross misinformation in github\nwiki he recently fixed:\n\n    From: Thomas Rast <trast@student.ethz.ch>\n    Subject: Re: [PATCH] pull: refuse complete src:dst fetchspec arguments\n    Date: Sun, 15 Nov 2009 13:24:03 +0100\n    Message-ID: <200911151324.05109.trast@student.ethz.ch>\n\nPerhaps that page had some impact on this misunderstanding? \n"},{"id":"127632","messageId":"4B006549.8050803@gmail.com","threadId":"21617","inReplyTo":"7vlji7k0dm.fsf@alter.siamese.dyndns.org","subject":"Re: Question about \"git pull --rebase\"","fromName":"Johan 't Hart","fromEmail":"johanthart@gmail.com","sentAt":"2009-11-15T20:32:09Z","receivedAt":"2009-11-15T20:32:09Z","isPatch":false,"sender":{"key":"johanthart@gmail.com","avatar":"https://gravatar.com/avatar/f7bd2928a1a23e971f4ab68a6c7b35d7ff0efb1c225c570430badf90e404e50b?d=mp&s=160"},"body":"Junio C Hamano schreef:\n> Johan 't Hart <johanthart@gmail.com> writes:\n>>> I've been somehow confused by the git-pull man page, which says:\n>>>\n>>>   A parameter <ref> without a colon is equivalent to <ref>: when\n>>>   pulling/fetching, so it merges <ref> into the current branch without\n>>>   storing the remote branch anywhere locally\n>>>\n\n> Thanks for clearing it up.\n> \n> I was puzzled by the above pointing-finger because I wanted to see where a\n> misinformation originated from to fix it at the source.  But still don't\n> see anything wrong with it.\n>\n\nMy guess is that he was confused by '<ref>:' not meaning '<ref>:<ref>'. \nBut I can't speak for him ofcource :)\n\nRefspecs confused me too at the beginning... But knowing more and more \nabout git, it seems that this part of the docs look OK to me.. At most \nan example might make things a little more clear, but I doubt it is \nnecessary.\n"},{"id":"127676","messageId":"38b2ab8a0911160400w8eaf3afjf53077e969e8c0f5@mail.gmail.com","threadId":"21617","inReplyTo":"4B006549.8050803@gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-11-16T12:00:36Z","receivedAt":"2009-11-16T12:00:36Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Sun, Nov 15, 2009 at 9:32 PM, Johan 't Hart <johanthart@gmail.com> wrote:\n> Junio C Hamano schreef:\n>>\n>> Johan 't Hart <johanthart@gmail.com> writes:\n>>>>\n>>>> I've been somehow confused by the git-pull man page, which says:\n>>>>\n>>>>  A parameter <ref> without a colon is equivalent to <ref>: when\n>>>>  pulling/fetching, so it merges <ref> into the current branch without\n>>>>  storing the remote branch anywhere locally\n>>>>\n>\n>> Thanks for clearing it up.\n>>\n>> I was puzzled by the above pointing-finger because I wanted to see where a\n>> misinformation originated from to fix it at the source.  But still don't\n>> see anything wrong with it.\n>>\n>\n> My guess is that he was confused by '<ref>:' not meaning '<ref>:<ref>'. But\n> I can't speak for him ofcource :)\n>\n\nWell, I don't remember how I started to think that:\n\n<src>:\n\nwas equivalent to\n\n<src>:<current-branch>\n\nso, assuming I'm on branch 'foo':\n\n$ git pull --rebase origin master:\n\nwas equivalent to\n\n$ git pull --rebase origin master:foo\n\nhence my confusion, which certainly due to my lack of attention\n(sorry) when reading the man page.\n\n> Refspecs confused me too at the beginning... But knowing more and more about\n> git, it seems that this part of the docs look OK to me.. At most an example\n> might make things a little more clear, but I doubt it is necessary.\n\nPerhaps, the definition of a refspec with an empty string for <dst>\nmight be clearer if defined on its own. For example, doing this in the\ngit-pull man page:\n\n      <refspec>\n           The format of a <refspec> parameter is an ....\n\n           The remote ref that matches <src> is fetched,\n\n                  if <dst> is not empty string, the local ref that\nmatches it is fast\n                  forwarded using <src>. If the optional plus + is\nused, the local ref is\n                  updated even if it does not result in a fast forward update.\n\n                  if <dst> is an empty string the fetched <src> is\nmerged into the\n                  current branch without updating any local refs. In\nthis case the\n                  optional + has no meaning.\n\n           Note\n                  ....\n\n           Some short-cut notations are also supported.\n\n               . A parameter <src> (<ref> without the ':<dst>' part)\nis equivalent\n                 to '<src>:' (a ref with an empty string for <dst>).\n\n\n-- \nFrancis\n"},{"id":"127678","messageId":"38b2ab8a0911160417w6b9cc943h5e87d4e22d0dea2b@mail.gmail.com","threadId":"21617","inReplyTo":"4AFF3D4D.7000308@gmail.com","subject":"Re: Question about \"git pull --rebase\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-11-16T12:17:51Z","receivedAt":"2009-11-16T12:17:51Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Sun, Nov 15, 2009 at 12:29 AM, Johan 't Hart <johanthart@gmail.com> wrote:\n> This does not update any remote tracking branches, but it will rebase your\n> foo branch on the remote master branch (which is what you want)\n> It could also be done with:\n>\n> git pull --rebase origin master:origin/master\n>\n> This will also update your remote tracking branch refs/remotes/origin/master\n> to match the master branch on the remote repo. Your foo branch will then be\n> rebased onto it.\n\nBTW, this seems to be not exact.\n\n$ git pull --rebase origin master:origin/master\n\nfetches the 'master' branch on the remote repo, then creates a new\nbranch 'origin/master', which is updated with the fetched branch.\n\nTo update the remote tracking branch refs/remotes/origin/master, I\nneed to issue:\n\n$ git pull --rebase origin master:remotes/origin/master\n\nBTW2,  it looks like if the <dst> local ref doesn't exist the it will\nbe created. This something that appears very lately in the man page\n(actually I can see the information only in the last example). This\ncould be part of the <refspec> defintion.\n\nThanks\n-- \nFrancis\n"}]}