Let me pretend you're asking a slightly different question: I've stripped part of my repository history, how do I propagate this change to other dev's repositories?
Mercurial offers no way of propagating stripping in the same way it propagates adding changesets. So you have to come up with your own way.
Bitbucket, for example, has an updates list (on the repo summary page, if my memory serves me well). If you do a strip, Bitbucket displays there something like this:
Changeset 12345abcdef was stripped from the repository, please run hg strip 12345abcdef
locally.
When we had to propagate stripping of part of an old branch in our shop, here's what we did:
- Stripped the changesets on the server.
- Created a batch file named
strip.bat
on the default
branch of the repo containing the command we'd run on the server, i.e. hg strip 1234567890
.
- Told everybody that whenever they cannot push because “push creates new remote heads” for no apparent reason, this means they should run
strip.bat
.
In case we ever need to strip something again, we just add another hg strip
in the batch file.
P.S. Yes it's better not to strip, e.g. use backout to commit inverse changesets. Sometimes that's not an option: if you mistakenly merged branch a
into branch b
when you wanted the merge b
into a
, you're trapped. Even if you backout the merge changeset on feature
, the merged changesets from a
are already marked as merged, and you'll have a hard time doing another merge of these branches.