本文介绍了Git不会让我合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好!

我知道这是非常平常的事,互联网上可能有成千上万的答案,但是我找不到一个真正的答案。 p>

我有两个本地分行:

lockquote


  • MASTER

  • Mk


我对Mk进行了很多更改,承诺这些,并切换到MASTER合并这两个分支。但是有冲突。所以现在我在MASTER分支上,不能切换到Mk了,但是需要用Mk覆盖我的MASTER。



它一直说

有没有办法做到这一点?

  git mergetool --tool = meld#无需合并文件
混帐合并 - 他们的MK#无法找到合并策略'他们的'。
git merge -X递归=他们的Mk#错误:对下列文件的本地修改

将被合并覆盖



,但我没有将我的更改推送到我的在线存储库。



我可以看到所有更改的提交,但无法访问它的代码。



刚开始使用git前一段时间,但从未遇到像以前的
这样的麻烦。我真的很感激任何帮助,我可以得到:s

解决方案

由于没有(即使有),难道你不能:


  • 将第一个主合并到mk: git checkout mk&& git merge -s我们的主人

  • merge mk to master(快进): git checkout master&& git merge mk



-s我们的战略将确保您在发生冲突时保持 mk 版本。


Good evening!

I know this is very usual and there are probably thousands of answers on the internet but I couldn't find one that was helfull.

I have two local branches:

I made a lot of changes to Mk, committed these, and switched to MASTER to merge these two branches. But there were conflicts. So now I am on the MASTER branch, can not switch to Mk anymore, but need to override my MASTER with Mk.

It keeps saying

Is there a way to do this?

 git mergetool --tool=meld    #No files need merging
 git merge -s theirs Mk       #Could not find merge strategy 'theirs'.
 git merge -X recursive=theirs Mk   # error: Your local changes to the following files 

would be overwritten by merge

and I did not push my changes to my online repository yet.

I can see the commit with all the changes but can not access its code.

Just started using git some time ago but never ran into troubles like that before. I would really appreciate any help I can get :s

解决方案

Since there isn't a --theirs strategy (even though there are ways to simulate it), couldn't you:

  • merge first master to mk: git checkout mk && git merge -s ours master
  • the merge mk to master (fast-forward): git checkout master && git merge mk

The -s ours strategy will make sure you keep mk version in case of conflicts.

这篇关于Git不会让我合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 05:11