我刚刚合并了两个分支'branch1'和'branch2'。问题是,它现在是一个混乱的许多冲突,有时重复的内容(这是可能的吗??)。
我想做的是强制从'branch1'的一些文件与'branch2'合并,反过来,强制从'branch2'的一些文件与'branch1'合并,知道我现在在'branch1'上。这可能吗?
更新:似乎有问题与gift -merge ?假设我保留branch1版本,那么
echo $this->fetch('prehome.html');
die;
将出现两次,参见:
protected function prehomepage()
{
$var = 'myvar';
echo $this->fetch('prehome.html');
die;
}
<<<<<<< HEAD
$this->mySmarty->assign('title', 'Primagora');
echo $this->fetch('prehome.html');
die;
}
/**
* Generate the campaign block for the general sidebar, called through AJAX.
*/
protected function getCampaignBlock()
{
$from = Utils::fromGet('from');
echo $this->getCampaignSidebarBlock($from);
die();
}
=======
/**
* Generate the campaign block for the general sidebar, called through AJAX.
*/
protected function getCampaignBlock()
{
$from = Utils::fromGet('from');
echo $this->getCampaignSidebarBlock($from);
die();
}
>>>>>>> branch2
对于有冲突的合并(如果设置了git config merge.conflictstyle diff3
),您可以:
- 忽略合并并保留原始版本(来自
branch1
):
- 忽略合并并保留其他版本(来自
branch2
):
从那里,git add
和git commit
。
您应该始终尝试解决冲突。他们告诉你很多正在发生的事情。
Netbeans可以与git一起工作,这使得解决冲突成为一个相当简单的任务。您可以逐个解决冲突,或者选择要保留的版本。
你说的内容重复是什么意思?如果两个文件中的内容完全相同,则不可能将其标记为更改您正在显示的文件是正在进行的git合并中的中间文件。
中的行<<<<<<< HEAD
=======
是
的一个版本========
>>>>>branch1
是另一个。然后,您可以手动编辑文件并选择要使用的版本,或者运行工具来帮助您解决冲突。git命令mergetool将指导您解决所有冲突的过程https://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html
git mergetool
git mergetool很可能需要配置为使用你最喜欢的冲突解决程序。我发现meld是非常有用和直观的。
Git mergetool with Meld在Windows或