Suppose you have two unpublished commits in Mercurial and like to join them into single commit:
... --> THIS --> ... --> THAT --> ... --> LAST
Check that your commits are not published:
$ hg glog -r "draft() & ($THIS | $THAT)"
Update to LAST
commit:
$ hg up
and import commits up to THIS
into MQ:
$ hg qimport $THIS::.
Un-apply all patches and apply only first THIS
:
$ hg qpop -a $ hg qpush $ hg qapplied ... THIS ...
Join with THAT
:
$ hg qfold $THATNAME
To find name THATNAME
use:
$ hg qseries
qfold
preserve commit messages!
Apply all patches and move them to repository history:
$ hg qpush -a $ hg qfinish -a
You can rearrange patches in MQ when they unapplied. In this way you may perform join in any
point of drafted changes. For this purposes edit .hg/patches/series
manually.
With hg qfold $(hg qunapp)
you can join all unapplied patches into current patch. Commit
messages would be preserved.
- https://www.mercurial-scm.org/wiki/ConcatenatingChangesets
-
Tips on official Mercurial wiki about concatenating changesets.
- https://www.mercurial-scm.org/wiki/RebaseExtension
-
Tips on official Mercurial wiki about rebase extension.
- http://stackoverflow.com/questions/1725607/can-i-squash-commits-in-mercurial
-
Can I squash commits in Mercurial?
- http://stackoverflow.com/questions/1200691/with-mercurial-how-can-i-compress-a-series-of-changesets-into-one-before-push
-
With Mercurial, how can I “compress” a series of changesets into one?