Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you Rebase an immutable changeset with Mercurial?

I'm trying to rebase some changes I pulled in to my local machine. I'm getting the error:

abort: can't rebase immutable changeset 110e73ed65a4
(see hg help phases for details)

And I get the same error even after I change the phase on the changesets that I'm rebaseing (and the phase change seems to be successful). using:

hg phase -f -d REV

I'm wondering if there's a changeset in the history that I'm missing and is still immutable, and if so, if there is a way that I can change all of the changesets in a changeset's history to be mutable with a single command.

Or, is there a way to force rebase, even with the immutable changesets?

like image 633
Subliminy Avatar asked Dec 27 '12 16:12

Subliminy


People also ask

What is rebase in HG?

Rebase allows moving commits around in Mercurial's history (using a series of internal merges). This has many uses: moving changesets between branches. "linearizing" history. reordering changesets.

What does HG update do?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.


1 Answers

Rebasing changes that are public is considered a very bad idea. You shouldn't change any history that's been pushed -- the point of phases is to track what changes haven't been pushed yet (so they're able to be modified), and what changes have been pushed (so they're immutable). From the rebase documentation:

You should not rebase changesets that have already been shared with others. Doing so will force everybody else to perform the same rebase or they will end up with duplicated changesets after pulling in your rebased changesets.

It's better to either merge in your changes or graft them in. Graft (also known as cherry-picking) takes one or more changesets and copies them to your current branch.

like image 133
zck Avatar answered Sep 27 '22 21:09

zck