如何制作“git diff”输出正常的差异格式(非统一,非上下文)? [英] How to make "git diff" output normal diff format (non-unified, non-context)?
本文介绍了如何制作“git diff”输出正常的差异格式(非统一,非上下文)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望 git diff
输出普通的普通旧差异输出(不是统一差异,而不是上下文差异)。
$ p
$ b
$ diff file1 file2
2c2
< p< b
---
> B
4d3
< d
5a5
> f
我不想统一输出:
$ diff -u file1 file2
--- file1 2012-07-04 07:57:48.000000000 -0700
+++ file2 2012-07-04 07:58:00.000000000 -0700
@@ -1,5 +1,5 @@
a
-b
+ B
c
-d
e
+ f
我不想要上下文输出:
$ diff -c file1 file2
*** file1 2012-07-04 07:57:48.000000000 -0700
- - file2 2012-07-04 07:58:00.000000000 -0700
***************
*** 1,5 ****
a
! b
c
- d
e
--- 1,5 ----
a
! B
c
e
+ f
我尝试了各种 git difftool --tool =
args没有运气,我在 git diff --help
解决方案
git difftool --extcmd = diff
或者不提示:
git difftool --extcmd = diff --no-prompt
这是 git difftool
而不是 git diff
,但它正在做我想要的。
I want git diff
to output normal, plain old diff output (not unified diff, and not context diff).
I want this:
$ diff file1 file2
2c2
< b
---
> B
4d3
< d
5a5
> f
I do NOT want unified output:
$ diff -u file1 file2
--- file1 2012-07-04 07:57:48.000000000 -0700
+++ file2 2012-07-04 07:58:00.000000000 -0700
@@ -1,5 +1,5 @@
a
-b
+B
c
-d
e
+f
I do NOT want context output:
$ diff -c file1 file2
*** file1 2012-07-04 07:57:48.000000000 -0700
--- file2 2012-07-04 07:58:00.000000000 -0700
***************
*** 1,5 ****
a
! b
c
- d
e
--- 1,5 ----
a
! B
c
e
+ f
I tried the various git difftool --tool=
args with no luck, and I didn't find anything relevant in git diff --help
解决方案
git difftool --extcmd=diff
or, without prompting:
git difftool --extcmd=diff --no-prompt
This is git difftool
rather than git diff
but it is doing what I want.
这篇关于如何制作“git diff”输出正常的差异格式(非统一,非上下文)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文