Instantly share code, notes, and snippets.

What would you like to do?
Mercurial command basics

add new files to next commit

hg add

revert all files to last commit

hg revert --all

revert a.txt to last commit

hg revert a.txt

remove from repository at next commit

hg remove b.txt

Log last three commits from b.txt

hg log -l 3 b.txt

Commit with comment

hg com -m "Just a nice comment"

what looked file a.txt like at revision 3

hg cat -r 3 a.txt

Difference between rev 1 and 2 of file a.txt

hg diff -r 1:2 a.txt

show all relevant changes in current directory since last commit

hg st
hg status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment