Mercurial - Multiple heads - how do I “discard” one head and take the other as tip / default?

I spotted someone elses repository on Bitbucket and made some changes (and pushed them to a forked repo). At the same time, the original author made significant changes (largely rewriting).

I want to update my repo so that it is exactly the same as it (but with my changes that are still present on this tag) so that it can easily pull my new changes without previous changes, which I influenced what -or.

I put its changes in my local version, which left me with two heads. I want to just take his head as a hint / default. I tried to resolve this (based on some SO answers) by doing:

hg update -r [myrev]
hg commit --close-branch
hg update -r [hisrev]

It seemed to put me in the state I wanted. My working directory looks like it. However, when I tried hg push, they told me that this would create a few deleted heads, and I'm not sure if this is what I want (the message makes it sound scary!)

So, did I do it right? Should I force a push? Will this do what I want (for example, to keep a copy of my changes so that I can get to them, but in a way that doesn't interfere at all?). If so, is this the best way to achieve this?

+3
source share
1 answer

The heads on the closed branch remain heads, so if you want to push these changes, you will need to --force.

, , . , :

hg update [hisrev]
hg --config ui.merge=internal:local merge [myrev]
hg commit

, , - .

+5

All Articles