So far I have been a heavy git user, but recently I found myself working on a project using Mercurial.
I must say that for me migrating from Subversion to git was far less painful than from git to Mercurial. I recently found myself working on a project using Mercurial for version control so I needed to get up to speed with Mercurial very fast. This cheatsheet might be of help to someone who finds themselves in a similar situation.
Start a new repo
Clone a remote repo
hg clone <URL>
Mercurial (along with other VCSs apparently), unlike git, does not require staging of files. Once a file has been added to the repo, it can then be committed.In Mercurial, you can list the files along with the commit command in order to commit a subset of the changes.
Add a file to the repo
hg add <file(s)>
Commit changes to the repo
hg commit [file(s)] [-m "Commit message"]
Commit deleted files
hg remove --after
Undo your last commit but keep the changes
Branching is important for collaborating in Git , in Mercurial you will mainly be creating branches and merging them into the
default branch (Mercurial’s version of git’s
Creating a branch
hg branch <name>
Switch to another branch
hg update <name>
Push a new branch
hg push --new-branch
Check your current branch
hg identify -b
hg merge <name>
Branch Status (`git status`)
hg resolve -i (lists files with resolved/unresolved conflicts)
On branches, Mercurial will not allow you to delete a branch after it has been merged because When you have merged the two branches, the merge commit depends on the existence of its two parent commits. That means that you can't remove the commits making up the merged branch unless you also delete the merge commit.
If GUI is your thing you can find a list of Mercurial clients here https://www.mercurial-scm.org/wiki/OtherTools