当前位置:   article > 正文

Your branch and 'origin/master' have diverged, and have # and # different commits each, respectively_your branch and '' have diverged, and have 18 and

your branch and '' have diverged, and have 18 and 1 different commits each,

一.如标题,当git有如上提醒时,意思是需要rebase或者merge了,具体情况如下:

When you have a message like:

“Your branch and ‘origin/master’ have diverged, # and have 1 and 1 different commit(s) each, respectively.”

check if you need to update origin. If origin is up-to-date, then some commits have been pushed to origin from another repo while you made your own commits locally.

… o ---- o ---- A ---- B origin/master (upstream work)
         \
         C master (your work)

You based commit C on commit A because that was the latest work you had fetched from upstream at the time.
However, before you tried to push back to origin someone else pushed commit B.
Development history has diverged into separate paths.

我们需要将我们工作区与远程的master进行同步进行合并:

使用:git merge origin/master  或者
git rebase origin/master

当然也可以将我们当前工作区的master分区pull到最新,直接
git rebase master或者git merge master
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述
二.rebase的好处

想要更好的提交树,使用rebase操作会更好一点。
这样可以线性的看到每一次提交,并且没有增加提交节点。

merge 操作遇到冲突的时候,当前merge不能继续进行下去。手动修改冲突内容后,add 修改,commit 就可以了。

而rebase 操作的话,会中断rebase,同时会提示去解决冲突。
解决冲突后,将修改add后执行git rebase –continue继续操作,或者git rebase –skip忽略冲突。

参考链接:https://www.cnblogs.com/scodong/p/4862932.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/559102
推荐阅读
相关标签
  

闽ICP备14008679号