Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branching and remote heads in Mercurial

Tags:

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?

like image 674
hekevintran Avatar asked Apr 07 '10 09:04

hekevintran


People also ask

What is a branch in Mercurial?

Branches occur if lines of development diverge. The term "branch" may thus refer to a "diverged line of development". For Mercurial, a "line of development" is a linear sequence of consecutive changesets. Combining a line of development into an existing one is called merging. Creating a branch.

How do I change my branch on mercurial?

Quickly switch to another branch or bookmarkIn the Status bar, click the Mercurial Branch widget to open the Branches popup. Select the branch or bookmark to which you want to switch and in the menu that opens, click Update.

How do you tag in mercurial?

To add a tag to the system, simply add a line to this file and then commit it for it to take effect. The hg tag command will do this for you and hg tags will show the currently effective tags.


1 Answers

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 hg push --new-branch to force it (or -f before version 1.6).

like image 99
Laurens Holst Avatar answered Dec 04 '22 23:12

Laurens Holst