Git 常用命令
Git Usual Command

环境:Git v2.38.2

本文对应此书: 《精通 Git》人民邮电出版社 [美]Scott Chacon、Bed Straub 著;门佳、刘梓懿 译 2017 年 9 月第一版 ISBN 9787115463067

页码 命令
11 git config --global user.name "John Doe"
11 git config --global user.email "johndoe@example.com"
11 git config --global core.editor emacs
12 git config --list
12 git config user.name
12 git help config
12 git config --help
12 man git-config
13 git init
13 git add *.c
14 git clone \https://github.com/libgit2/libgit2
14 git clone \https://github.com/libgit2/libgit2 mylibgit
15 git status
16 git status -s
16 git status --short
19 git diff
20 git diff --staged
21 git diff --cached
21 git commit
22 git commit -m "Story: 182: Fix benchmarks for speed"
23 git commit -a -m "add new benchmarks"
23 git rm PROJECTS.md
24 git rm --cached README
24 git rm log/*.log
24 git rm*~
24 git mv README.md README
25 git log
25 git log -p -2
26 git log stat
27 git log pretty=oneline
27 git log pretty=format:"%h - %an , %ar : %s"
28 git log --prety=format:"%h &s" --graph
29 git log --since:2.weeks
29 git log -Sfunction_name
30 git commit --amend
31 git reset HEAD CONTRIBUTING.md
32 git chedkout -- CONTRIBUTING.md
33 git remote
33 git remote -v
33 git remote add pb \https://github.com/paulbune/ticgit
34 git fetch pb
34 git push origin master
35 git remote show origin
36 git remote rename pb paul
36 git rm paul
36 git tag
37 git tag -a v1.4 -m "my version 1.4"
38 git tag v1.4-lw
38 git show v1.4-lw
38 git tag 0a v1.2 9fceb02
39 git push origin --tags
40 git chedkout -b version2 v2.0.0
40 git config --global alias.co checkout
44 git branch testing
45 git log --online --decorate
47 git log --oneline --decorate --graph --all
48 git checkout -b iss53
50 git merge hotfix
51 git branch -d hotfix
56 git branch -v
56 git branch --merged
56 git branch --no-merged
61 git fetch origin
63 git push origin serverfix
63 git push origin serverfix:serverfix
64 git push origin serverfix:awesomebranch
64 git merge origin/serverfix
64 git checkout -b serverfix origin/serverfix
65 git checkout --track origin/serverfix
65 git checkout -b sf origin serverfix
65 git branck -u origin/serverfix
65 git merge @{u}
65 git branch -vv
66 git fetch --all
66 git pull
66 git push origin --delete serverfix
67 git rebase master
69 git rebase --onto master server client
70 git rebase master server
74 git pull --rebase