Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added link to "Git hg rosetta stone" at


hg command

hg description

git command

git description

hg add

add the specified files on the next commit

git add

Add file contents to the index.
(* TODO: add notes below on what are the git notions of the "index" etc. and how they relate to hg concepts.) 

hg annotate

show changeset information by line for each file

 git blame


hg backup

backup workspace changes and metadata



hg clone

make a copy of an existing repositoryNote repository Note that with hg, this copies everything from the parent, including all branches, and gives you a working copy of the default branch.

 git clone


hg commit

commit the specified files or all outstanding changes. Creates only a local change set.

 git commit


hg diff

diff repository (or selected files) 

git diff / git diff --cached


hg export $ID

dump the header and diffs for one or more changesetsThis produces a file that entirely captures the contents of the change set specififed by $ID.The resulting file can be consumed by "hg import". (This is often useful for transporting changes between different workspaces and/or branches, etc.)

 git format-patch <commits>


hg forget

forget the specified files on the next commit

 git reset <paths> / git checkout – <paths>


hg incoming

show a list of change sets that would be pulled.(with -v, also show list of files in each)

 git fetch <remote> && git whatchanged ..<remote>/branch


hg init

create a new repository in the given directory

 git init


hg list

list active files(those changed in this workspace)

 git diff --name-only <commits>


hg log
hg log FILE 

show revision history of entire repository
show revision history of specified file

 git log


hg merge

merge working directory with another revision

 git merge/git pull


hg nits

check for stylistic nits in active files(onbld extension)

 git nits


hg outgoing

show a list of change sets that would be pushed.(with -v, also show list of files in each)

git whatchanged

show changes between ...

hg pbchk

run pre-integration checks on this workspace(onbld extension)

 git pbchk


hg pdiffs

diff workspace against its parent(onbld extension)

 git diff <other branch>..


hg pull

pull changes from the specified source("pull -u" to update as well)

 git fetch / git pull


hg push

push changes to the specified destination

 git push


hg qdiff

diff of the current patch and subsequent modifications(mq extension)



hg qnew

create a new patch(mq extension)



hg qpop

pop the current patch off the stack(mq extension)



hg qpush

push the next patch onto the stack(mq extension)



hg qrefresh

update the current patch(mq extension)



hg recommit

replace outgoing changesets with a single equivalent changeset(onbld extension)

 git rebase -i


hg remove

remove the specified files on the next commit

 git rm


hg restore

restore workspace from backup



hg serve

start stand-alone webserver



hg status

show changed files in the working directory(One letter prefixes like the old cvs status)

 git status


hg summary

summarize working directory state



hg update

update working directory (or switch revisions)updates local working copy from local repo.

 git checkout



creates an input file for webrev(1) that references the change set ID for the parent, and lists all the modified files. Usage:hg-active -w `pwd` > Active.txtwebrev txt webrev -w Active.txt

 Not available separately to webrev


edit .hg/cdm/*.NOT

Exception files for "hg nits", etc.cddlchk.NOT, copyright.NOT, cstyle.NOT, ...Add file names to these files to cause "hg nits" to skip the (possibly lengthy) noise about them.