{"thread":{"id":"50649","subject":"is \"git rebase ... [branch]\" equivalent to first \"git checkout [branch]\"?","startedAt":"2019-03-04T20:41:21Z","lastAt":"2019-03-04T22:54:19Z","messageCount":2,"participants":["Robert P. J. Day","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"370638","messageId":"alpine.LFD.2.21.1903041536460.12447@localhost.localdomain","threadId":"50649","inReplyTo":null,"subject":"is \"git rebase ... [branch]\" equivalent to first \"git checkout [branch]\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2019-03-04T20:41:16Z","receivedAt":"2019-03-04T20:41:21Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  i *think* i know the answer to this based on man page and reading\nthe code, but i just want to verify that i'm not missing any subtlety.\n\n  according to \"man git-rebase\":\n\n   git rebase [-i | --interactive] [<options>] [--exec <cmd>]\n       [--onto <newbase>]\n       [<upstream> [<branch>]]\n\nand:\n\n  \"If <branch> is specified, git rebase will perform an automatic git\ncheckout <branch> before doing anything else. Otherwise it remains on\nthe current branch.\"\n\n  is it *absolutely* equivalent to either specify the final \"[branch]\"\nargument on \"git rebase\", or to just \"git checkout branch\" first\nbefore running the rebase, then leaving off that final argument?\n\n  everything i've seen suggests those two things are identical, but\ni've been fooled before.\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n\n"},{"id":"370646","messageId":"xmqq4l8iw8rv.fsf@gitster-ct.c.googlers.com","threadId":"50649","inReplyTo":"alpine.LFD.2.21.1903041536460.12447@localhost.localdomain","subject":"Re: is \"git rebase ... [branch]\" equivalent to first \"git checkout [branch]\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-04T22:54:12Z","receivedAt":"2019-03-04T22:54:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n\n>   i *think* i know the answer to this based on man page and reading\n> the code, but i just want to verify that i'm not missing any subtlety.\n> ...\n>   \"If <branch> is specified, git rebase will perform an automatic git\n> checkout <branch> before doing anything else. Otherwise it remains on\n> the current branch.\"\n\nYes, but with a caveat ;-)\n\nAt least, the original scripted version of \"git rebase\" both\ndesigned and implemented the final extra \"rebase this one, not the\ncurrent branch\" argument as a pure short-hand for lazy people (like\nme, who wanted to have such a feature and made it so) to be exact\nequivalent to \"checkout before doing anything else\".  Which means\nthat HEAD@{} reflog would record such an event as \"checkout that\nswitched to the branch\", and it would have affected the computation\nneeded if you said \"git checkout @{-1}\" after the rebase finished.\n\nI do not offhand know if the current verison of \"git rebase\" that\nwas reimplemented in C changed the behaviour, though.\n\n\n"}]}