版权相关: 本文截取自读懂diff-阮一峰的网络日志
Unix diff
-
normal
$ diff f1 f2 4c4 < a --- > b
- context
$ diff -c f1 f2 *** f1 2012-08-29 16:45:41.000000000 +0800 --- f2 2012-08-29 16:45:51.000000000 +0800 *************** *** 1,7 **** a a a !a a a a --- 1,7 ---- a a a !b a a a
- unified
$ diff -u f1 f2 --- f1 2012-08-29 16:45:41.000000000 +0800 +++ f2 2012-08-29 16:45:51.000000000 +0800 @@ -1,7 +1,7 @@ a a a -a +b a a a
Git diff
$ git diff diff --git a/f1 b/f1 index 6f8a38c..449b072 100644 --- a/f1 +++ b/f1 @@ -1,7 +1,7 @@ a a a -a +b a a a