有没有办法提出一个更复制粘贴友好的差异,这意味着没有像统一格式(+ - )或默认格式(<>)那样的前面的字符?也许用额外的行上的标记包围更改的代码,如下所示:
some_context code
++++ Added 3 lines:
line 1
line 2
line 3
++++ END added lines
some context code
---- Deleted 1 line:
deleted line
---- END deleted line
some context code
而不是
some_context code
+ line 1
+ line 2
+ line 3
some context code
- deleted line
some context code
答案 0 :(得分:1)
阅读完文档后,您确实可以使用line-format
和group-format
参数指定自己的格式。
以下是我需要的文档中的示例:
diff \
--unchanged-group-format='' \
--old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
%<' \
--new-group-format='-------- %dN line%(N=1?:s) added after %de:
%>' \
--changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
%<-------- to:
%>' \
old new
链接: