推荐使用软件
配置
# 查看配置信息
git config
git config user.name
# 配置用户名和邮箱 去掉
git config
git config
基本操作
git init
git clone git://github.com/schacon/grit.git mygrit
git status -s
git diff
git checkout [file]
git checkout .
git add [file1] [file2]
git add [dir]
git add .
git reset HEAD A.php
git commit [file1] [file2] -m "提交说明"
git commit -m "提交说明"
git commit -am "提交说明"
git commit --no-verify -m "提交说明"
git commit --amend -m "提交说明2"
git reset --soft HEAD^
git reset [--soft | --mixed | --hard] [HEAD]
git reset HEAD^
git reset HEAD~1
git reset 052e A.php
git rm [file]
git rm -f [file]
git rm --cached [file]
git add README
git mv README README.md
git log --oneline
git blame [file]
git remote -v
git remote show https://github.com/tianqixin/runoob-git-test
git remote rm name
git remote rename oldName newName
git fetch origin
git merge origin/master
git pull origin
git push origin master
分支管理
git branch myBranch
git checkout -b myBranch
git branch -d branchName
git merge Bbranch
git reset --hard [merge前commitId]
git branch --track [branch] [remoteBranch]
git branch --set-upstream [branch] [remote-branch]
git cherry-pick [commit]
git push origin --delete [branch-name]
git branch -dr [remote/branch]
标签
git tag -a v1.0
git tag -a v2.0 85fc7e7
git tag
git tag -d v1.0
git show v2.0
git tag -a tagName -m "xxx标签"
git tag -s tagName -m "xxx标签"
git push origin v1.0