Note that there are some explanatory texts on larger screens.

plurals
  1. POHg: How to do a rebase like git's rebase
    text
    copied!<p>In Git I can do this:</p> <pre> 1. Start working on new feature: $ git co -b newfeature-123 # (a local feature development branch) do a few commits (M, N, O) master A---B---C \ newfeature-123 M---N---O 2. Pull new changes from upstream master: $ git pull (master updated with ff-commits) master A---B---C---D---E---F \ newfeature-123 M---N---O 3. Rebase off master so that my new feature can be developed against the latest upstream changes: (from newfeature-123) $ git rebase master master A---B---C---D---E---F \ newfeature-123 M---N---O </pre> <p><br /></p> <p>I want to know how to do the same thing in Mercurial, and I've scoured the web for an answer, but the best I could find was: <a href="https://www.mercurial-scm.org/pipermail/mercurial/2007-June/013393.html" rel="noreferrer">git rebase - can hg do that</a></p> <p>That link provides 2 examples:<br /> 1. I'll admit that this: (replacing the revisions from the example with those from my own example)</p> <pre> hg up -C F hg branch -f newfeature-123 hg transplant -a -b newfeature-123 </pre> <p>is not too bad, except that it leaves behind the pre-rebase M-N-O as an unmerged head and creates 3 new commits M',N',O' that represent them branching off the updated mainline.</p> <p>Basically the problem is that I end up with this:</p> <pre> master A---B---C---D---E---F \ \ newfeature-123 \ M'---N'---O' \ newfeature-123 M---N---O </pre> <p>this is not good because it leaves behind local, unwanted commits that should be dropped.</p> <ol start="2"> <li>The other option from the same link is </li> </ol> <pre> hg qimport -r M:O hg qpop -a hg up F hg branch newfeature-123 hg qpush -a hg qdel -r qbase:qtip </pre> <p>and this does result in the desired graph:</p> <pre> master A---B---C---D---E---F \ newfeature-123 M---N---O </pre> <p>but these commands (all 6 of them!) seem so much more complicated than </p> <pre> $ git rebase master </pre> <p>I want to know if this is the only equivalent in Hg or if there is some other way available that is simple like Git.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload