rebase to ancestor: just do it

Ethan Tira-Thompson ejt at cmu.edu
Fri Sep 9 15:06:47 UTC 2011


I often seem to run into the following problem:

I’m working on a smallish feature/bugfix/whatever, made a couple local commits but not ready to push it yet.

Then I’m alerted to some other bug/issue and fix that, maybe making a couple local commits on that.  This secondary issue is independent and I want to push it out for other people and go back to my main item.

"Oh crap, I forgot to start a branch and now item 2’s patches are based on my item 1 work."

"Well I’ll just rebase item 2 back to the last public changeset... oh but rebase doesn’t work on ancestors, wtf."

So now I have to do some hacks with transplanting the first changeset of item 2 to get a new head and then rebasing the rest onto that.  Same effect, but stupidly awkward.  Why can’t rebase do this directly, it’s a common nuisance that I want to rebase something to a shared changeset before pushing.  Often that changeset happens to be an ancestor, but I don't think that should matter.

-Ethan




More information about the Mercurial mailing list