Basic Commands
hg branch
- display the branch you're currently on.
hg branches
- display all branches for the current repository.
hg checkout <branchname>
- checkout the specified branch. Also if you want to disregard any local changes before switching use the --clean
option.
hg status
- show all files that have changes pending.
hg diff
- output the pending changes of all files.
hg commit -m <commit message>
- commit pending changes to your current branch.
hg pull
- get the most recent changes done to the repo, from the remote server.
hg update
- this will attempt to merge all the changes from the remote pull, to your local file system.
hg push
- push all your changes up to the remote server.
Extra Commands
hg serve
- by default, will start a server on localhost:8000, which will give you a neat little UI in your browser to view your mercurial logs, branch graphs, tags, bookmarks, and branches. It also has a help section to get more detailed info on hg
commands, and whatnot.
hg graph -r <commit revision>
- when you want to pull in a specific change revision to your branch without pulling anything else (similar to git cherry-pick
). Also depending on your Mercurial version, you can also use hg transplant
more info
hg shelve
and hg unshelve
- set your pending changes aside temporarily and restore them at a later time. more info