常用命令

# 代码下载git clone xxxxxx# 日志git log# 代码回退git reset --hard 提交id# 缓存管理git stash listgit stash drop stash@{0}git stash clear# 查看状态 git status# 本地分支管理    # 创建git checkout -b 本地分支名 远程分支名git checkout -b 本地分支名 -t 远程分支名# 查看git branch -agit branch# 删除git branch -d 分支名# 切换git checkout 分支名# 合并 分支A合并到Bgit checkout Bgit merge A# 代码回退# 回退到某个版本git reset --hard <commit_id>git push origin HEAD --force# 回退本地commitgit reset HADEgit push origin developer --force# 逆向提交本地commitgit revert HADEgit addgit commitgit push

代码提交流程

# 缓存本地修改git stash # 拉取远程代码git pull# 提取本地缓存git stash pop# 解决冲突、提交代码