https://github.com/sympy/sympy/wiki/Git-hg-rosetta-stone
Git hg rosetta stone
Use it like a dictionary hg -> git.
Rosetta Stone
=============
|hg |git |
|hg cat -r rev |git show rev:some_file |
|some_file | |
|hg clone |git clone git://git.sympy.org/sympy.git |
|http://hg.sympy.org/s| |
|ympy-git.hg | |
|hg clone -U |git clone --bare git://git.sympy.org/sympy.git |
|http://hg.sympy.org/s| |
|ympy-git.hg | |
|hg diff |git diff HEAD |
|hg status |git status |
|hg manifest |git ls-tree -r --name-only --full-tree HEAD |
|hg parents |git show --pretty=format:'%P' -s |
|hg commit |git commit -a |
|hg record |git add -p; git commit # or, for a more detailed |
| |interface: git add -i; git commit |
|hg email -r tip |git send-email HEAD^ # or: git format-patch HEAD^ ; git|
| |send-email 0001-Add-whitespace.patch |
|hg view |gitk, git gui |
|hg help command |git help command |
|~/.hgrc |~/.gitconfig |
|.hg/hgrc |.git/config |
|hg paths |git remote -v |
|editing paths in |git remote add name url # see "git help remote" for |
|.hg/hgrc |more info how to edit paths; alternatively, you can |
| |edit them by hand in .git/config too |
|.hgignore |.gitignore |
|.hg/hgrc [ui] ignore |.git/info/exclude |
|hg add |git add (note, it adds _content_ to index; can work on |
| |a hunk-by-hunk basis with -p!) |
|hg rm |git rm |
|hg push |git push |
|hg pull |git fetch |
|hg pull -u |git pull |
|hg addremove |git add -A (or: git add .; git ls-files --deleted xargs|
| |git rm) |
|hg revert -a |git reset --hard |
|hg revert some_file |git checkout some_file |
|hg strip 2fccd4c |git reset --hard 2fccd4c^ |
|hg export |git format-patch |
|hg import --no-commit|git apply some.patch |
|some.patch | |
|hg import some.patch |git am some.patch |
|hg out |git fetch && git log FETCH_HEAD..master |
|hg in |git fetch && git log master..FETCH_HEAD |
|hg update tip |git checkout HEAD # or this: "git checkout master", or |
| |"git merge FETCH_HEAD", depending on what you did |
| |before this |
|hg update -C |git checkout -f |
|hg update some.branch|git checkout some.branch # Note that "git branch |
| |some.branch" is not the same as this. |
|hg qimport |stg something (A separate patch manager extension is |
| |probably not necessary in git -- normal workflow |
| |combined with git rebase -i should cover your needs) |
|hg qpush |(see hg qimport) |
|hg qpop |(see hg qimport) |
|hg qimport -r tip |? |
|hg qnew -f some.patch|? |
|hg resolve -a -m |git add -u |
|hg glog |git log --graph --all --decorate # or: git log --graph |
| |--all; |
|hg verify |git fsck |
Setup
=====
~/.gitconfig:
[user]
name = Ondrej Certik
email = ondrej@certik.cz
[color]
ui = auto
[color]
decorate = short
[alias]
ci = commit
di = diff --color-words
st = status
# aliases that match the hg in / out commands
out = !git fetch && git log FETCH_HEAD..
outgoing = !git fetch && git log FETCH_HEAD..
in = !git fetch && git log ..FETCH_HEAD
incoming = !git fetch && git log ..FETCH_HEAD