版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ransom0512/article/details/49150501
代码操作命令
$ git clone https://github.com/HuaweiBigData/StreamCQL
$ git pull
$ git status
$ git log
$ git add fileName
$ git add
$ git reset HEAD fileName
$ git checkout
$ git commit -m "comments"
$ git push origin dev
分支管理
$ git branch
$ git branch -r
$ git branch -a
$ git branch dev
$ git push origin dev
$ git checkout dev
$ git push origin --delete dev
$ git branch --delete dev
$ git remote prune origin
远程操作
$ git remote
$ git remote -v
$ git remote add upstream https://github.com/HuaweiBigData/StreamCQL.git
$ git remote rm upstream
$ git remote rename upstream newname
$ git fetch upstream
$ git fetch upstream master
$ git merge upstream/master
$ git checkout -b upmaster upstream/master
标签
$ git tag
$ git tag [tag]
$ git tag [tag] [commit]
$ git tag -d [tag]
$ git push origin :refs/tags/[tagName]
$ git show [tag]
$ git push [remote] [tag]
$ git push [remote] --tags
$ git checkout -b [branch] [tag]
查看
$ git status
$ git log
$ git log --stat
$ git log --follow [file]
$ git whatchanged [file]
$ git log -p [file]
$ git blame [file]
$ git diff
$ git diff --cached [file]
$ git diff HEAD
$ git diff [first-branch]...[second-branch]
$ git show [commit]
$ git show --name-only [commit]
$ git show [commit]:[filename]
$ git reflog
重置
$ git checkout [file]
$ git checkout [commit] [file]
$ git checkout .
$ git reset [file]
$ git reset --hard
$ git reset [commit]
$ git reset --hard [commit]
$ git reset --keep [commit]
$ git revert [commit]
打包
$ git archive
说明:
部分命令引用自:http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html