持续更新ing...
// 更改分支名字
git branch -m 旧名字 新名字
// 拉取远程代码
git pull origin xxx
// 代码合并
git merge xxx
// 代码推送到远程分支( -f 强制推送)
git push origin xxx
git push -f origin xxx
// 删除远程分支
git push origin :xxx
// 删除本地分支
git branch -D xxx
// 新建分支
git branch xxx
// 新建分支并切换到该分支下
git checkout -b xxx
// 查看所有分支
git branch -a
// 删除本地最近n次提交记录
git reset --hard HEAD~n
//撤销上次提交记录,并进入暂存区
git reset --hard HEAD~n
// 版本回退
git revert <commit_id>
// 查看该分支下的提交记录
git log
// 查看当前项目下提交用户的相关信息
git config user.name
git config user.email
// 更改当前项目下提交用户的相关信息
git config user.name xxx
git config user.email xxx
// 更改全局提交用户的相关信息
git config --global user.name xxx
git config --global user.email xxx
// cherry-pick记录剪切
git cherry-pick xxx
// 剪切多条记录
git cherry-pick commitA..commitB //commitA必须早于commitB,剪切结果不包含commitA
git cherry-pick commitA^..commitB //剪切结果包含 commitA和commitB
// 查看历史操作(多用于误操时得撤销操作)
git reflog
git reset --hard '你想要回退的commitid'
// 查看远程仓库地址
git remote -v
// 切换远程分支
git remote rm origin
git remote add origin URL
// 从已有的仓库替换git地址
git remote add origin '你的git地址'
git push -u origin master
// 暂存修改,提交备注
git add .
git commit -m '提交备注命名'
// .gitignore文件失效,初始化git
git rm -r --cached .