如何将本地的wyy分支合并并推送到远端的 develop分支?
规则:最好是本地的分支wyy推送到对应的远端origin/wyy ,不建议直接推送到远端不同的分支!!所以
基本思路如下:
1.本地的wyy分支推送到对应的远端origin/wyy,
2.本地的wyy合并到本地的develop分支,
3.本地的develop分支推送到对应的远端origin/develop
最终保持wyy,origin/wyy,develop,origin/develop都处于同一个版本即可。
先说一个小插曲:
为什么合并之后显示的: wyy>origin/wyy 和 develop>origin/develop 不在同一个版本上?
因为直接在 develop 上更改,且直接提交到远端,所以develop一直比wyy高一个版本,如果是按下面的修改wyy,然后合并到develop,则不会出现这种问题。
一.使用sourcetree合并分支
1.切换到本地分支 ,将自己本地修改的分支推送到自己的远端分支,wyy>origin/wyy(此时wyy与origin/wyy统一版本)


2.切换到develop分支,然后选择wyy分支,右键“合并wyy至当前分支",将wyy分支合并到develop分支上,wyy>develop(此时wyy与develop统一版本)


3.将develop分支推送到远端分支,develop>origin/develop(此时develop与origin/develop统一版本)


此时,wyy ,origin/wyy,develop,origin/develop都处于同一个版本啦!!!合并成功~

二.直接使用编辑器IDEA自带的git合并分支
1.修改本地文件后,首先检出wyy分支(check out即检出当前要操作的分支)


2.选中文件,右键git>选中提交的文件,添加注释,提交和push到自己的远端分支


此时可以看到wyy和远端分支都提前develop分支


3.切换检出到develop分支


4.选中wyy,并merge(混合,合并),将wyy分支合并到develop分支上


5.然后shift+K,可以直接弹出提交和push的弹窗,此时直接将develop提交到远端即可。