scm/hg-git-rosetta-stone
author Tomas Zeman <tzeman@volny.cz>
Sun, 25 Aug 2013 21:04:14 +0200
changeset 34 11d20ddca9d8
permissions -rw-r--r--
scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands If you know how to use hg very well and just looking at how to do the same things in git, this page is right for you. Use it like a dictionary hg -> git.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     1
https://github.com/sympy/sympy/wiki/Git-hg-rosetta-stone
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     2
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     3
Git hg rosetta stone
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     4
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     5
Use it like a dictionary hg -> git.
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     6
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     7
Rosetta Stone
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     8
=============
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     9
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    10
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    11
|hg                   |git                                                    |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    12
|hg cat -r rev        |git show rev:some_file                                 |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    13
|some_file            |                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    14
|hg clone             |git clone git://git.sympy.org/sympy.git                |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    15
|http://hg.sympy.org/s|                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    16
|ympy-git.hg          |                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    17
|hg clone -U          |git clone --bare git://git.sympy.org/sympy.git         |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    18
|http://hg.sympy.org/s|                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    19
|ympy-git.hg          |                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    20
|hg diff              |git diff HEAD                                          |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    21
|hg status            |git status                                             |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    22
|hg manifest          |git ls-tree -r --name-only --full-tree HEAD            |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    23
|hg parents           |git show --pretty=format:'%P' -s                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    24
|hg commit            |git commit -a                                          |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    25
|hg record            |git add -p; git commit # or, for a more detailed       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    26
|                     |interface: git add -i; git commit                      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    27
|hg email -r tip      |git send-email HEAD^ # or: git format-patch HEAD^ ; git|
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    28
|                     |send-email 0001-Add-whitespace.patch                   |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    29
|hg view              |gitk, git gui                                          |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    30
|hg help command      |git help command                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    31
|~/.hgrc              |~/.gitconfig                                           |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    32
|.hg/hgrc             |.git/config                                            |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    33
|hg paths             |git remote -v                                          |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    34
|editing paths in     |git remote add name url # see "git help remote" for    |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    35
|.hg/hgrc             |more info how to edit paths; alternatively, you can    |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    36
|                     |edit them by hand in .git/config too                   |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    37
|.hgignore            |.gitignore                                             |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    38
|.hg/hgrc [ui] ignore |.git/info/exclude                                      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    39
|hg add               |git add (note, it adds _content_ to index; can work on |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    40
|                     |a hunk-by-hunk basis with -p!)                         |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    41
|hg rm                |git rm                                                 |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    42
|hg push              |git push                                               |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    43
|hg pull              |git fetch                                              |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    44
|hg pull -u           |git pull                                               |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    45
|hg addremove         |git add -A (or: git add .; git ls-files --deleted xargs|
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    46
|                     |git rm)                                                |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    47
|hg revert -a         |git reset --hard                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    48
|hg revert some_file  |git checkout some_file                                 |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    49
|hg strip 2fccd4c     |git reset --hard 2fccd4c^                              |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    50
|hg export            |git format-patch                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    51
|hg import --no-commit|git apply some.patch                                   |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    52
|some.patch           |                                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    53
|hg import some.patch |git am some.patch                                      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    54
|hg out               |git fetch && git log FETCH_HEAD..master                |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    55
|hg in                |git fetch && git log master..FETCH_HEAD                |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    56
|hg update tip        |git checkout HEAD # or this: "git checkout master", or |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    57
|                     |"git merge FETCH_HEAD", depending on what you did      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    58
|                     |before this                                            |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    59
|hg update -C         |git checkout -f                                        |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    60
|hg update some.branch|git checkout some.branch # Note that "git branch       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    61
|                     |some.branch" is not the same as this.                  |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    62
|hg qimport           |stg something (A separate patch manager extension is   |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    63
|                     |probably not necessary in git -- normal workflow       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    64
|                     |combined with git rebase -i should cover your needs)   |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    65
|hg qpush             |(see hg qimport)                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    66
|hg qpop              |(see hg qimport)                                       |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    67
|hg qimport -r tip    |?                                                      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    68
|hg qnew -f some.patch|?                                                      |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    69
|hg resolve -a -m     |git add -u                                             |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    70
|hg glog              |git log --graph --all --decorate # or: git log --graph |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    71
|                     |--all;                                                 |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    72
|hg verify            |git fsck                                               |
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    73
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    74
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    75
Setup
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    76
=====
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    77
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    78
~/.gitconfig:
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    79
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    80
 [user]
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    81
     name = Ondrej Certik
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    82
     email = ondrej@certik.cz
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    83
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    84
 [color]
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    85
     ui = auto
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    86
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    87
 [color]
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    88
     decorate = short
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    89
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    90
 [alias]
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    91
     ci = commit
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    92
     di = diff --color-words
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    93
     st = status
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    94
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    95
     # aliases that match the hg in / out commands
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    96
     out      = !git fetch && git log FETCH_HEAD..
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    97
     outgoing = !git fetch && git log FETCH_HEAD..
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    98
     in       = !git fetch && git log ..FETCH_HEAD
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    99
     incoming = !git fetch && git log ..FETCH_HEAD
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
   100
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
   101
11d20ddca9d8 scm/hg-git-rosetta-stone: simplified mapping between hg commands and git commands
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
   102