hg: how do I push newly created branch back into central repository?

It depends on the version of Mercurial that you’re using. The command used to be hg push -f ... or hg push --force ... to force the creation of a new branch in the remote repository (which is usually OK).

However, using -f also allows you to create new heads in the remote repository (usually not OK), so current versions of Mercurial (1.6 and above) have a --new-branch option to hg push that allows you to create a branch, but not create a new head, so the command is:

hg push --new-branch

You can also limit pushes to just the branch that you’re working on with the -b flag, so:

hg push --new-branch -b v1

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)