为什么git无法合并? [英] Why is git not able to merge?

查看:152
本文介绍了为什么git无法合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将我的一个分支重新绑定到另一个分支时,git无法合并并引发冲突。我可以在冲突的文件中看到以下内容:

 <<<<<<< HEAD 
=======
if(($ mode =='w')){
$ mode ='r';
var_export($ GLOBALS,true);
//打印(< pre>);
// var_dump(array_keys($ GLOBALS));
// print(< / pre>);
}
>>>>>>> 7896670 ...我从其他目录进行的一些初始更改...

我只是想知道为什么git不能合并这两个提交?这是一个微不足道的合并,不是吗?一个版本包含 nothing ,另一个版本包含 ,所以合并很简单。我错过了什么?

解决方案

检查它们的共同祖先(合并基础) - 它应该包含别的东西

  git diff`git merge-base HEAD 7896670` HEAD 


When I try to rebase one of my branches onto another, git is not able to merge and raises conflict. I can see the following in the conflicted file:

<<<<<<< HEAD
=======
  if (($mode == 'w')) {
    $mode = 'r';
    var_export($GLOBALS, true);
    //print("<pre>");
    //var_dump(array_keys($GLOBALS));
    //print("</pre>");
  }
>>>>>>> 7896670... Some initial changes that I carried over from other directory...

I am just wondering why git is not able to merge these two commits? It is a trivial merge, isn't it? One version contains nothing and another version contains something, so the merge is simple. What am I missing?

解决方案

Check the common ancestor of them (the merge base) -- it should contains something else.

git diff `git merge-base HEAD 7896670` HEAD

这篇关于为什么git无法合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆