git 配置相关命令
1 2 3 4 5 6 7 8
| git init git config --global user.name "xxx" git config --global user.email "xxx@xxx.com" git config --global color.ui true git config --global color.status auto git config --global color.diff auto git config --global color.branch auto git config --global color.interactive auto
|
git 克隆、增加、提交到、推送等相关命令
1 2 3 4 5 6 7 8 9 10 11
| git clone git+ssh://git@192.168.53.168/VT.git git pull origin master git status git add xyz git add . git commit -m 'xxx' git commit --amend -m 'xxx' git commit -am 'xxx' git push origin master git push origin :hotfixes/BJVEP933 git push --tags
|
git 删除、标签、查看日志相关命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| git rm xxx git rm -r * git mv README README2 git log git log -1 git log -5 git log --stat git log -p -m git log --pretty=format:'%h %s' --graph git show dfb02e6e4f2f7b573337763e5c0013802e392818 git show dfb02 git show HEAD git show HEAD^ git tag git tag -a v2.0 -m 'xxx' git show v2.0 git log v2.0 git ls-files git show-branch git show-branch --all git whatchanged git reflog git show HEAD@{5} git show master@{yesterday} git show HEAD~3 git show -s --pretty=raw 2be7fcb476
|
git 比较文件、创建分支、检出、合并相关命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| git diff git diff --cached git diff HEAD^ git diff HEAD -- ./lib git diff origin/master..master git diff origin/master..master --stat git remote add origin git+ssh://git@192.168.53.168/VT.git git branch git branch --contains 50089 git branch -a git branch -r git branch --merged git branch --no-merged git branch -m master master_copy git checkout -b master_copy git checkout -b master master_copy git checkout features/performance git checkout --track hotfixes/BJVEP933 git checkout v2.0 git checkout -b devel origin/develop git checkout -- README git merge origin/master git cherry-pick ff44785404a8e git fetch git fetch --prune git reset --hard HEAD git rebase git branch -d hotfixes/BJVEP933 git branch -D hotfixes/BJVEP933 git revert dfb02e6e4f2f7b573337763e5c0013802e392818 git ls-tree HEAD git rev-parse v2.0
|
git暂存等相关命令
1 2 3 4 5 6 7 8
| git stash git stash list git stash show -p stash@{0} git stash apply stash@{0} git grep "delete from" git grep -e '#define' --and -e SORT_DIRENT git gc git fsck
|
参考地址
1 2 3 4 5
| http://rogerdudler.github.io/git-guide/index.zh.html
https://github.com/progit/progit/tree/master/zh
https://github.com/blynn/gitmagic/tree/master/zh_cn
|