Skip to content

Instantly share code, notes, and snippets.

@flc
Last active August 29, 2015 14:05
Show Gist options
  • Save flc/f867e2b92cc878a55801 to your computer and use it in GitHub Desktop.
Save flc/f867e2b92cc878a55801 to your computer and use it in GitHub Desktop.
hg vs git
hg init || git init
hg add <path> || git add <path>
hg commit -m 'Commit message' || git commit -m 'Commit message'
hg commit || git commit -a
hg status || git status -s
hg clone <path> || git clone <path>
hg branch <branchname> || git checkout -b <branchname> (-b also switch to new branch)
hg pull & hg update || git pull --all
hg diff || git diff HEAD
hg rm || git rm
hg push || git push
hg update <branch> || git checkout <branchname>
hg branches || git branch
hg revert filename || git checkout filename (This command is also used to checkout branches, and you could happen to have a file with the same name as a branch. All is not lost, you will simply need to type: git checkout -- filename)
hg revert || git reset --hard
hg log -l 5 || git log -n 5
hg merge <branch> || git merge <branch>
hg import <diff_file> || git apply <diff_file>
set default editor to <editor>:
git config --global core.editor <editor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment