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