Search code examples
mercurialtortoisehg

Remove a revision in TortoiseHG


I know this question has been asked and I know it´s against version control. But we have done some minor changes in the layout etc. and would like to remove the history of 30 revisions.

Is it possible to just remove these 30 revisions or merge them into one revision?

Like 160 was the last big one and then now we are on 195 but the 35 in beetween are all relatively small css changes so not really necessary for us. Is it possible to just get them into like 161 and then go from there?


Solution

  • I find using hg revert -r REV is a much easier approach that using histedit.

    Don't do this if you have already pushed your changes.

    Observe that the changesets that are being merged are all 'draft' phases.

    Intial State

    1. Update to parent of the first changeset in set of changes you want to fold.

    Update to parent of first change set that you want to fold

    1. "hg revert -r REV -all" (where rev is the last change you want to fold) (ie. the tip - if its not the tip then you will have to do a rebase step between step 3 and step 4).

    enter image description here

    1. Commit.

    Commit all the changeset as one change

    1. Use strip to remove old changesets

    Using the Strip command

    And the final result:

    Finished result

    It would be really nice to be able to do step 2 directly from the thg gui but I haven't found a way of doing it.