I have starting using Mercurial for my (our) versioning needs. I have now come to the point that I need to create a feature branch. However, now that I have started working on it — and I try to push my changes, I keep getting a warning about new remote heads. That’s stupid, I know that there will be new remote head(s) that’s what a branch after all is?
How am I supposed to create branches and push them without this problem, without using force push as it is surely not the right way to go, right?
I thought about using separate repositories, but that feels just stupid especially for feature branches.
Any help welcome!
To date, the best guide out there is Steve Losh’s “A Guide to Branching in Mercurial“.
Mercurial will always complain about creating new heads on the remote. You must use either
--forceor--new-branchwhen creating a new head.When using TortoiseHg, the same can be accomplished via the
Synchronizeview of the Workbench. ClickOptionsand then select theAllow push of a new branchorForce push or pulloption, as needed.The reason it behaves this is way is that the Mercurial developers wanted to make it a conscious decision to create a new head on the remote. Their view is that typical workflows should merge changes prior to pushing.