Git development
 help / color / mirror / Atom feed
From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: git@vger.kernel.org
Subject: [RFD] make rebase abort to original branch, not rebased branch
Date: Sat, 12 Mar 2011 22:58:20 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1103122253560.15442@debian> (raw)

When git rebase is aborted, it will return the HEAD to the rebased
branch (which has not moved). If the current branch is "topic" and a
run of "git rebase master" is aborted, "topic" is therefore checked
out, which is both what I expect and what I want. When the
two-argument version of git rebase is used, as in "git rebase master
topic", and then aborted, "topic" will be checked out. This is not
what I would expect, although I'm aware of it by now, and usually not
what I want. I would expect to be returned to the branch/commit that
was checked out when I started "git rebase master topic".

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.

 2. I once was rebasing many old branches, mostly to see which ones
    could be rebased without conflicts. The project I was working on
    was pretty big and a lot had changed since those old branches were
    created. If a "new" branch is currently checked out and "git
    rebase master old-branch" is run and causes conflicts, the old
    branch would be checked out. In my case, this would take 5-10
    seconds. Since Junio improved rebase in 0cb0664 (rebase [--onto O]
    A B: omit needless checkout, 2008-03-15), there will be no
    checkouts of any "old" commit in the successful case, so it's a
    shame that it has to happen in the unsuccessful case when the
    rebase is aborted.

Are there valid cases where the current behavior is bettter?

I suppose we can not just change the current behavior due to backward
compatibility constraints. We could introduce a configuration
variable, of we could perhaps change it in 1.8.0. Maybe the problem is
not big enough to do either...


/Martin

             reply	other threads:[~2011-03-13  3:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-13  3:58 Martin von Zweigbergk [this message]
2011-03-13  7:05 ` [RFD] make rebase abort to original branch, not rebased branch Junio C Hamano
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=alpine.DEB.2.00.1103122253560.15442@debian \
    --to=martin.von.zweigbergk@gmail.com \
    --cc=git@vger.kernel.org \
    /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