Skip to content

Instantly share code, notes, and snippets.

@upangka
Last active January 14, 2020 03:50
Show Gist options
  • Save upangka/a770720772f5727f89b0ad8b88f2d229 to your computer and use it in GitHub Desktop.
Save upangka/a770720772f5727f89b0ad8b88f2d229 to your computer and use it in GitHub Desktop.
开创bug分支,通过pull request方式,提交合并代码,这样有利于解决冲突

背景

由于多人开发,开发后有各自的bug需要处理,如在dev-v2.7分支上,修复bug,则需要每人自己拉取一个分支进行bug修复,修复完成之后,将分支pull request方式 到dev-v2.7分支上,在web页面进行。

  1. 将本地拉取出来的bug分支提到远程 参考链接
git branch bugfix-2.7-1003991 //创建分支
git push origin bugfix-2.7-1003991

然后再web页面发起new pull request请求

  1. 删除bug分支,首先需要切换到其他分支
D:\huice-git\java-mp (bugfix-2.7-1003991 -> origin/[email protected])
λ git branch -D bugfix-2.7-1003991   //在要删除的分支下,不能删除该分支
error: Cannot delete branch 'bugfix-2.7-1003991' checked  out at 'D:/huice-git/java-mp'

D:\huice-git\java-mp (bugfix-2.7-1003991 -> origin/[email protected])
λ git checkout dev-v2.7   // 切换分支
Switched to branch 'dev-v2.7'
M       jmp/mp-config/src/main/resources/application-dev-win.properties
M       web-vue/config/dev.env.js
M       web-vue/src/util/request.js
Your branch is behind 'origin/dev-v2.7' by 8 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

D:\huice-git\java-mp (dev-v2.7 -> origin/[email protected])
λ git branch -D bugfix-2.7-1003991    // 删除分支

删除远程分支命令

git push origin -d bugfix-2.7-xxx

误删分支恢复

背景

bug分支合并到dev-v2.7分支,然后删除了该bug分支,但是该bug分支并没有合并到dev-v2.8

参考链接

merge时出现冲突

在web页面提示bug分支合并到dev-v2.8时出现冲突

首先需要 在本地分支拉取,git pull origin dev-v2.8 远程分支dev-v2.8,然后进行手动合并

然后add,commit到该bug仓库,然后再将该分支git push origin bugfix-2.7-1003991上去,(会覆盖线上之前的bugfix-2.7-1003991分支)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment