I have a pair of commits that should really be just one. If I was using git, I would use:
git rebase -i
and then
I think chistedit (built in since Mercurial 2.3) is the closest to rebase -i that is pure Mercurial (chistedit is the interactive version of histedit). Once in histedit the fold command maps to rebase's squash and roll command maps to rebase's fixup. See histedit docs for more info.
Here is a simple example. Assume you have the following and want to move all 1e21c4b1's changes into the previous revision and just keeping the previous revision's message.
@ 1e21c4b1 drees tip
| A commit you want to squash
o b4a738a4 drees
| A commit
o 788aa028 drees
| Older stuff
You can run hg chistedit -r b4a738a4 to edit history back to b4a738a4. In chistedit you then cursor down to 1e21c4b1 and hit r to indicate you want to roll that revision. Do note that the order in histedit (oldest to newest) is reversed from hg log (newest to oldest).
#0 pick 160:b4a738a49916 A commit
#1 ^roll 161:1e21c4b1500c
After choosing your changes, you then choose c to commit them. The result is the following:
@ bfa4a3be drees tip | A commit o 788aa028 drees | Older stuff
If you are relatively new to them, then histedit can be a better choice than chistedit because it provides the command descriptions in histedit file for reference. It just takes a bit more editing to set the commands using normal text editing (just like normal rebase).
Note, to use either histedit or chistedit you need to add histedit to your extensions in your ~/.hgrc:
[extensions]
histedit =
I suggested chistedit since it is closest to rebase -i and works anywhere in the history. If you really just want subsume/tweak the current revision into the previous one then @G. Demecki's strip suggestion can be good since what is happening is clear. It is built in since Mercuria 2.8. To get the equivalent results as above you can do the following:
hg strip .
hg add
hg commit --amend
Note strip, like histedit, needs to be enabled in your ~/.hgrc:
[extensions]
strip =