19

How do I remove a feature branch in mercurial if I want to remove it completely? It should be stripped from the history and I don't want to merge the changes in another branch (just throw the code away).

I know that I can clone my other branches to a new repository like described here but that does not seem to be a clean solution.

Community
  • 1
  • 1
schlamar
  • 9,238
  • 3
  • 38
  • 76
  • possible duplicate of [How to remove changesets from a Mercurial repository?](http://stackoverflow.com/questions/4520697/how-to-remove-changesets-from-a-mercurial-repository) – Tim Henigan Jun 18 '12 at 14:24
  • @TimHenigan The solution is the same, but it is a completely different workflow and the reason why I didn't find it in the first place. I am not sure how this should be handled on SO. It might be OK closing this question because a search with this keywords will no link to the solution. – schlamar Jun 20 '12 at 07:36

1 Answers1

25

I found a working solution here.

It works by using hg strip from the mq extension:

$ hg strip my_pruned_branch

As mentioned in the comments, this should only be used for unpublished changesets.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
schlamar
  • 9,238
  • 3
  • 38
  • 76