{"thread":{"id":"39300","subject":"What happened to having to recover from upstream rebase?","startedAt":"2015-05-11T19:50:15Z","lastAt":"2015-05-13T09:44:06Z","messageCount":3,"participants":["Phil Susi","Johannes Schindelin","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261015","messageId":"555107F7.1040906@gmail.com","threadId":"39300","inReplyTo":null,"subject":"What happened to having to recover from upstream rebase?","fromName":"Phil Susi","fromEmail":"phillsusi@gmail.com","sentAt":"2015-05-11T19:50:15Z","receivedAt":"2015-05-11T19:50:15Z","isPatch":false,"sender":{"key":"phillsusi@gmail.com","avatar":null},"body":"So it used to be that when upstream rebased, you'd get an error when you \ntried to pull again and have to fix things up with some git reset or \nrebase hackery.  Trying to demo this today I found that the pull \n*worked*, using an automatic recursive merge.\n\nAm I crazy in thinking this used to error, and if not, when did it change?\n"},{"id":"261160","messageId":"b1686e402e9459e58acc7700a12f377d@www.dscho.org","threadId":"39300","inReplyTo":"555107F7.1040906@gmail.com","subject":"Re: What happened to having to recover from upstream rebase?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-05-13T09:37:18Z","receivedAt":"2015-05-13T09:37:18Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Phil,\n\nOn 2015-05-11 21:50, Phil Susi wrote:\n> So it used to be that when upstream rebased, you'd get an error when\n> you tried to pull again\n\nNot necessarily. You would get this error *only* if there was a merge conflict between the revisions (one revision being your remote-tracking branch *before* the pull, the other revision being your remote-tracking branch *after* the fetch implied by the pull).\n\n> and have to fix things up with some git reset\n> or rebase hackery.  Trying to demo this today I found that the pull\n> *worked*, using an automatic recursive merge.\n> \n> Am I crazy in thinking this used to error, and if not, when did it change?\n\nYou are not crazy, but I believe it might be a misunderstanding how the rebased upstream and the pull interact. When an upstream branch is rebased after you merge it, you have essentially two disagreeing versions of upstream.\n\nMy reading is that you mistook the error Git showed when trying to merge two disagreeing versions of upstream for an error produced by pull *directly* when it detects that upstream has been rebased. There is no such test in `git pull`, though. And when the upstream is rewritten in a way that does *not* cause merge conflicts [*1*], your workflow simply does not work.\n\nThe easy way out is to use `git pull --rebase` which figures out from the previously fetched revisions of the upstream branch what commits were dropped/rewritten and does not attempt to merge them. Note: Your local commits on top of upstream are also rebased which possibly leads to conflicts using this method.\n\nCiao,\nJohannes\n\nFootnote *1*: It is very easy to rewrite a branch in such a way: just amend the commit message and you end up with two disagreeing histories, where the *working directories* corresponding to the disagreeing revisions are identical and therefore merged in the most trivial manner. \n"},{"id":"261164","messageId":"vpq617wzuah.fsf@anie.imag.fr","threadId":"39300","inReplyTo":"b1686e402e9459e58acc7700a12f377d@www.dscho.org","subject":"Re: What happened to having to recover from upstream rebase?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-13T09:44:06Z","receivedAt":"2015-05-13T09:44:06Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> Hi Phil,\n>\n> On 2015-05-11 21:50, Phil Susi wrote:\n>> So it used to be that when upstream rebased, you'd get an error when\n>> you tried to pull again\n>\n> Not necessarily. You would get this error *only* if there was a merge\n> conflict between the revisions (one revision being your\n> remote-tracking branch *before* the pull, the other revision being\n> your remote-tracking branch *after* the fetch implied by the pull).\n\nHowever, you would get an error if you try to *push* (non-fast forward,\nbecause the remote has new commits which are different from yours even\nthough they represent similar changes). And one solution to this error\nwould be some rebase or reset magic.\n\nSo, Phil, that may be the error you remember.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}