0

How can I delete a local branch in Mercurial using terminal or TortoiseHg?

user1941537
  • 6,097
  • 14
  • 52
  • 99
  • Related: https://stackoverflow.com/questions/11681218/how-to-delete-a-branch-in-hg – StayOnTarget May 28 '19 at 11:40
  • 2
    Possible duplicate of [Discard a local branch in Mercurial before it is pushed](https://stackoverflow.com/questions/6989262/discard-a-local-branch-in-mercurial-before-it-is-pushed) – StayOnTarget May 28 '19 at 11:42

1 Answers1

1

In Mercurial, the existence of a branch is implied by the existence of commits that are in/on that branch. Hence to delete a branch, you must strip out all the commits that are in/on that branch. The simplest way to do that is using hg strip. See Is there any way to delete local commits in Mercurial?

(Note that there are some tricky conditions when commits within the branch are parents of merges. It's probably unwise to try to remove a branch that has ever been merged to anything.)

torek
  • 448,244
  • 59
  • 642
  • 775