git merge自动解决而不是显示合并冲突

问题描述

我有两个分支featuredevelopment,为简单起见,假设两个分支都只有一个文件,例如test.py

功能分支中,test.py如下

--few lines ---
renewal_id = models.IntegerField(null = True)
renewal_counter = models.IntegerField(null = True)

在开发部门中,test.py如下

--few lines ---
renewal_id = models.IntegerField(null = True)
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)

对于合并,我要从temporary_branch_for_merging创建一个名为feature的新分支,并将development合并到新分支中,但是它会自动解决不显示合并冲突

git checkout feature
git branch -b temporary_branch_for_merging
git merge development

我希望它显示冲突,但文件自动合并,最终结果如下:

--few lines ---
renewal_id = models.IntegerField(null = True)
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)
 

我希望最终输出像什么:

--few lines ---
renewal_id = models.IntegerField(null = True)
renewal_counter = models.IntegerField(null = True) <<< this line to get added after the merge
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)

git diff my_hash:test.py HEAD:test.py中进行temporary_branch_for_merging时,我得到类似的东西:

  --few lines ---
  renewal_id = models.IntegerField(null = True)
- renewal_counter = models.IntegerField(null = True)
+ cancelled_amount = models.IntegerField(null = True)
+ cancelled_amount_tax = models.IntegerField(null = True)
+ cancelled_by = models.CharField(null = True)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)