views:

302

answers:

1

I created a new branch using this command: hg branch new_branch

After the first commit to the new branch, the default branch becomes inactive. If this is pushed the central repository will have only one head which belongs to the new branch.

When my colleague pushes his commits on the default branch, he will get this error:

pushing to ssh://...
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)

Is there anything bad about forcing the push? Why are remote heads bad?

How do you work remotely on separate branches and push to one repository?

+7  A: 

Remote heads are bad because you’re basically pushing the effort of merging onto another person. This message is there to prevent people from accidentally introducing remote heads, telling them to merge first before pushing.

In this case though, you have created a named branch, meaning you intentionally introduce and share a new head, and you can discard the warning as informational. Use push -f to force it.

Laurens Holst
They are adding a --new-branch option by the way which you can use in the future as a safer alternative to --force. The commit error message should also be improved.
Laurens Holst