差异+补丁-总和而不是替换 [英] Diff + patch - Sum instead of replace

查看:53
本文介绍了差异+补丁-总和而不是替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个文件A,其中包含以下文件:

Say I have a file A, which contains this:

a = 5

还有一个文件B,如下所示:

And a file B, like this:

b = 5

现在,很明显diff会产生这样的东西(补丁):

Now, it's obvious that diff will produce something like this (the patch):

1c1

< a = 5

---

> b = 5

修补文件A显然会将其内容替换为文件B的内容,从而导致文件A包含

Patching file A will obviously replace its contents with those of file B, resulting in file A containing

b = 5

但是,我要做的是不同的.我希望文件A和B的内容合并,以便在修补文件A后将包含

What I want to do, however, is different. I want the contents of files A and B to merge, so that after patching file A it will contain

a = 5

b = 5

我的情况是,课程的方式比我的示例复杂得多,但我认为除了最后的差异/补丁外,我已经弄清楚了.

My case if course way more complex than my example but I think I've figured it out except for the summative diff/patch at the end.

tl; dr:我希望对差异/补丁进行求和而不是替换文件中的差异.我该怎么办?

tl;dr: I want the diff/patch to sum rather than replace the differences in the files. How can I do that?

推荐答案

您不想修补某些文件,而是尝试合并它们.有很多工具可以为您提供帮助,例如看看 kdiff

You don't want to patch some files, you are trying to merge them. There are lot's of tools out there that will help you, e.g. take a look at kdiff!

修改:其他一些工具:

  • 融化
  • gPyFm
  • diff3
  • tkdiff
  • P4Merge

至少 vim -d 可以完成工作;-)

At least vim -d will do the job ;-)

这篇关于差异+补丁-总和而不是替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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