git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFD] make rebase abort to original branch, not rebased branch
Date: Sat, 12 Mar 2011 23:05:18 -0800	[thread overview]
Message-ID: <7vmxkzijpt.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1103122253560.15442@debian> (Martin von Zweigbergk's message of "Sat, 12 Mar 2011 22:58:20 -0500 (EST)")

Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:

> In most cases, this is just a small annoyance, since it's usually
> quick and easy to manually switch back to the original
> branch. However, I have run into at least two cases where it has been
> a bit more annoying:
>
>  1. When on a detached HEAD and running "git rebase HEAD topic", if
>     you abort the rebase, you will have to look up the old commit in
>     the reflog.

Doesn't this merely show a bad discipline? What were you envisioning to
do to your detached HEAD state if the rebase were to succeed? IOW, if the
state was so precious, why did you decide to switch to topic and rebase it
onto that state, without marking?

> Are there valid cases where the current behavior is bettter?

I don't particularly like the "when aborted it returns to the original
location" behaviour even for a single argument "git rebase A" case (I do
deeply care about the tip of the branch that you attempted to rebase _is_
set back to the original state, but I don't care deeply on which branch
you would end up on myself), but because "git rebase A B" is a shorthand
for "git checkout B; git rebase A" (at least that is how I view it
myself), I would imagine that it would be more surprising to switch back
to the branch you were on which may not have anything to do with A nor B.

At least going back to B conceptually makes more sense in one use case I
have, which was the original reason I invented rebase with the "checkout B
and rebase it ono A" shorthand in the first place (see 59e6b23), back when
I was an active contributor throwing patches at Linus (note that back then
I didn't have "abort then go back" in the code--and that is why I don't
care too deeply about this "which branch should I be after aborting?"
myself).

The reason I tried to rebase B on A with the short-hand form was because I
wanted to clean up what is on B; I may say "abort" when my first attempt
to rebase failed because it was a bit too much to bite at once (e.g. the
history diverged a bit too much since B forked from A's ancestor).

But then, the next thing I would want to do in such a case after aborting
is not to give up and forget about what I needed to do, which is to clean
up B into a shape easier to merge with the updated codebase that leads to
A.  I would want to stay on B and examine the situation a bit deeper, and
try to figuire out a different base (e.g. a bit older commit in the
history leading to A) to rebase to, so that I can keep up with the other
branch incrementally without lagging too far behind.  Switching away from
the original B would be majorly annoying in such a case.

  reply	other threads:[~2011-03-13  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-13  3:58 [RFD] make rebase abort to original branch, not rebased branch Martin von Zweigbergk
2011-03-13  7:05 ` Junio C Hamano [this message]
2011-03-13  7:46   ` Junio C Hamano
2011-03-13 14:58   ` Martin von Zweigbergk
2011-03-13 15:27     ` Alexander Miseler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vmxkzijpt.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=martin.von.zweigbergk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).