git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* is "git rebase ... [branch]" equivalent to first "git checkout [branch]"?
@ 2019-03-04 20:41 Robert P. J. Day
  2019-03-04 22:54 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2019-03-04 20:41 UTC (permalink / raw)
  To: Git Mailing list


  i *think* i know the answer to this based on man page and reading
the code, but i just want to verify that i'm not missing any subtlety.

  according to "man git-rebase":

   git rebase [-i | --interactive] [<options>] [--exec <cmd>]
       [--onto <newbase>]
       [<upstream> [<branch>]]

and:

  "If <branch> is specified, git rebase will perform an automatic git
checkout <branch> before doing anything else. Otherwise it remains on
the current branch."

  is it *absolutely* equivalent to either specify the final "[branch]"
argument on "git rebase", or to just "git checkout branch" first
before running the rebase, then leaving off that final argument?

  everything i've seen suggests those two things are identical, but
i've been fooled before.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: is "git rebase ... [branch]" equivalent to first "git checkout [branch]"?
  2019-03-04 20:41 is "git rebase ... [branch]" equivalent to first "git checkout [branch]"? Robert P. J. Day
@ 2019-03-04 22:54 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2019-03-04 22:54 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

>   i *think* i know the answer to this based on man page and reading
> the code, but i just want to verify that i'm not missing any subtlety.
> ...
>   "If <branch> is specified, git rebase will perform an automatic git
> checkout <branch> before doing anything else. Otherwise it remains on
> the current branch."

Yes, but with a caveat ;-)

At least, the original scripted version of "git rebase" both
designed and implemented the final extra "rebase this one, not the
current branch" argument as a pure short-hand for lazy people (like
me, who wanted to have such a feature and made it so) to be exact
equivalent to "checkout before doing anything else".  Which means
that HEAD@{} reflog would record such an event as "checkout that
switched to the branch", and it would have affected the computation
needed if you said "git checkout @{-1}" after the rebase finished.

I do not offhand know if the current verison of "git rebase" that
was reimplemented in C changed the behaviour, though.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-04 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 20:41 is "git rebase ... [branch]" equivalent to first "git checkout [branch]"? Robert P. J. Day
2019-03-04 22:54 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).