How to remove multiple heads in mercury

I am new to mercurial. I put some files in by mistake and it shows how different chapters are in the main repository. Can someone tell me how to remove this head.

Many thanks

+3


source to share


2 answers


I don't think you really want to remove the heads. If you do this, you will lose the work that was done on those branches.

You probably want to merge the heads back into one branch.

Say you have a tree:

o  4 : Head 1
|
o  3 : Another commit
|  
| o 2 : Head 2
| |
|/
o  1 : A commit
|
o  0 : Initial commit

      

To get rid of the extra head without losing the work contained within it, you combine the two heads (versions 2 and 4 in this example) like this:



hg update 4
hg merge 2
hg commit -m "Merge"

      

This will create another commit that has all the changes in versions 2, 3 and 4 in one head like this:

o     5: Merge
|\
o |   4 : Head 1
| |
o |   3 : Another commit
| | 
| o   2 : Head 2
| |
|/
o     1 : A commit
|
o     0 : Initial commit

      

This is a standard procedure when several developers work in the same repository.

+5


source


You can enable the "mq" extension by editing the file .hgrc

. Make sure the following lines are present:

[extensions]
mq =

      



Then you can "remove" a specific revision, which will remove it so you only have one head:

hg strip ...

      

+7


source







All Articles