赞
踩
一.如标题,当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
二.rebase的好处:
想要更好的提交树,使用rebase操作会更好一点。
这样可以线性的看到每一次提交,并且没有增加提交节点。
merge 操作遇到冲突的时候,当前merge不能继续进行下去。手动修改冲突内容后,add 修改,commit 就可以了。
而rebase 操作的话,会中断rebase,同时会提示去解决冲突。
解决冲突后,将修改add后执行git rebase –continue继续操作,或者git rebase –skip忽略冲突。
参考链接:https://www.cnblogs.com/scodong/p/4862932.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。