Git常用命令速查
创建版本库
$ git clone <url>
$ git init
$ git config --global user.name 用户名
$ git config --global user.email 邮箱
修改和提交
$ git status
$ git diff
$ git add .
$ git add <file>
$ git mv <old> <new>
$ git rm <file>
$ git rm --cached file
$ git commit -m "commit message"
$ git comm it -- amend
查看历史提交
$ git long
$ git log -p <file>
$ git blame <file>
取消
$ git reset --hard HEAD
$ git checkout HEAD file
$ git revert <commit>
分支与标签
$ git branch
$ git checkout <branch/tag>
$ git branch <new-branch>
$ git branch -d <branch>
$ git tag
$ git tag <tagname>
$ git tag -d <tagname>
合并与衍合
$ git merge <branch>
$ git rebase <branch>
远程操作
$ git remote -v
$ git remoe show <remote>
$ git remote add <remote> url
$ git fetch <remote>
$ git pull <remote> <branch>
$ git push <remote> <branch>
$ git push <remote> :<branch/tag-name>
$ git push --tags