中关村村草 发表于 2012-01-29 16:05

diff

diff







在看<<version control with git >> 时偶然发现里面提到的一个GNU tool--GNU diff,好吧,其实我比较山,不知道上面这个这么好用的工具。



跟git diff 的比较

Administrator@PC-NAME ~/Desktop/ssh/repos/test (master)
$ echo 'hello' > test
Administrator@PC-NAME ~/Desktop/ssh/repos/test (master)
$ git add .
warning: LF will be replaced by CRLF in test.
The file will have its original line endings in your working directory.
Administrator@PC-NAME ~/Desktop/ssh/repos/test (master)
$ echo 'hello world' > test
Administrator@PC-NAME ~/Desktop/ssh/repos/test (master)
$ git diff
diff --git a/test b/test
index ce01362..3b18e51 100644
--- a/test
+++ b/test
@@ -1 +1 @@
-hello
+hello world
warning: LF will be replaced by CRLF in test.
The file will have its original line endings in your working directory.



GNU diff 比较两个文件的不同(self-explanation)
# echo 'hello' >test
# echo 'hello world' > test2
# diff -u test test2
--- test      2012-01-26 01:56:07.000000000 +0800
+++ test2       2012-01-26 01:56:28.000000000 +0800
@@ -1 +1 @@
-hello
+hello world

Reference :


<<version control with git >>.chapter 6.git diff

如果有一天21 发表于 2012-01-29 16:05

谢谢分享

lastfile 发表于 2012-02-02 00:08

谢谢分享;P ;P

Shell_HAT 发表于 2012-02-03 15:20

cmp a.txt b.txt
页: [1]
查看完整版本: diff