补丁无拒绝

补丁无拒绝

这个问题可能已经有了答案,但很难搜索——基本上,

patch发现某个块/块无法申请时,它将拒绝更改的块到拒绝文件中。

如何不将冲突放入拒绝文件中而是包含在最终输出中,只是git发现冲突时在最终输出中包含两个版本

$ cat merge.txt
<<<<<<< HEAD
this is some content to mess with
content to append
=======
totally different content to merge later
>>>>>>> new_branch_to_merge_later

答案1

GNU 补丁有一个--merge选项

--merge or --merge=merge or --merge=diff3
  Merge a patch file into the original files similar to diff3(1)
  or merge(1).  If a conflict is found, patch outputs a warning
  and brackets the conflict with <<<<<<< and >>>>>>> lines.  A
  typical conflict will look like this:

      <<<<<<<
      lines from the original file
      |||||||
      original lines from the patch
      =======
      new lines from the patch
      >>>>>>>

  The optional argument of --merge determines the output format
  for conflicts: the diff3 format shows the ||||||| section with
  the original lines from the patch; in the merge format, this
  section is missing.  The merge format is the default.

  This option implies --forward and does not take the --fuzz=num
  option into account.

奇怪的是我找不到这个GNU diffutils 文档(在哪里其他patch选择已记录)。

相关内容