collapse after rebase

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Dec 8 01:43:01 UTC 2008


On Sun, 7 Dec 2008 17:33:30 -0800, "Dmitriy Morozov" <hg at foxcub.org> wrote:
> Suppose I clone a repository, make a number of local commits, then
> pull from the remote repository, and want to rebase my local changes.
> Furthermore, suppose I want to collapse them. If I remember this from
> the start, and do `hg rebase --collapse`, then everything works out
> perfectly as I intend. However, if I do `hg rebase`, and then remember
> that I wanted to collapse the local changes, is there a way to do
> this? Or did I screw up my entire local repository?
>
> I guess another way of asking this question is whether it's possible
> to use rebase --collapse to collapse a linear set of changes (with no
> merges in or out) on a head?

After you are done rebasing, you can do something like:

    hg update -C first-rebased-changeset
    hg revert --no-b -r tip-most-rebased-change
    hg ci -m 'New log'

This should create a 'collapsed' changeset with all the changes from all
the rebased changesets.

Then you can 'hg strip' the old rebased changesets as usual.  Note,
however, that the 'strip' command is a destructive operation, so make
sure you keep a backup of the changes, or do your experiments in a
separate clone.




More information about the Mercurial mailing list