Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add symbolic name for Mercurial repository

📅 2014-Feb-28 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

When you clone a repository in Mercurial, it creates a file .hg/hgrc in the new clone repository. Typically, this has the following lines:

default =

That is, it has the login, the source location (directory or internet domain), the repository owner and finally the repository name. This assigns a symbolic name of default to this repository. After this any push or pull command is done with this repository.

If you created a new Mercurial repository and want to push it to another existing repository, then the command is:

$ hg push

If you want to push or pull without having to specify the repository, then just create a .hg/hgrc file and add the above lines to it.

If you want to add other repositories to push-pull from, add them on separate lines with a different symbolic name, not default:

default =
bkp =

You can push-pull from that repository using the symbolic name you have given it:

$ hg pull bkp

Tried with: Mercurial 2.0.2 and Ubuntu 12.04 LTS