一. 创建版本库
git clone git@github.com:Lin-Tui/gitTest.git
git clone -b remote_branchName git@github.com:Lin-Tui/gitTest.git
git init
二. 修改和提交
touch fileName
mkdir dirName
rm fileName
rm -r dirName
cat fileName
cd dirName
cd .
cd ..
git status
git diff
git mv oldFileName newFileName
git * rm
git * rm -r
git add .
git add fileName
git commit fileName -m "commit message"
git commit -m "commit message"
git commit -m "commit message" -a
三. 查看提交历史
git log
git log -p fileName
git blame fileName
四. 分支与标签
git branch
git branch -r
git branch local_branchName
git branch -d local_branchName
git checkout local_branchName
git checkout -b local-branchName
git tag
git tag --list
git tag tagName
git push origin tagName
git push --tag
git tag -d tagName
git push origin :tagName
五. 分支与合
git merge branchName
git rebase branchName
六. 远程操作
git remote -v
git remote show <remote>
git remote add origin git@github.com:Lin-Tui/gitTest.git
git fetch <remote>
git pull
git pull origin master
git pull origin remote_branchName
git push --set-upstream origin remote_branchName
git push
git push origin master (--force)
git push origin local_branchName:remote_branchName
git push origin remote_branchName
git push origin :remote_branchName
下载和上传指定分支
七. 撤销
git checkout a.js
git checkout .
git checkout head a.js
git checkout head .
git reset HEAD a.js
git reset --hard HEAD
git revert <commit>
git reset --hard <commit>
Git常用命令速查表(收藏大全)