免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1532 | 回复: 3
打印 上一主题 下一主题

diff [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-01-29 16:05 |只看该作者 |倒序浏览
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)
[root@HOSTNAME ~]# echo 'hello' >test
[root@HOSTNAME ~]# echo 'hello world' > test2
[root@HOSTNAME ~]# 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

论坛徽章:
0
2 [报告]
发表于 2012-01-29 16:05 |只看该作者
谢谢分享

论坛徽章:
0
3 [报告]
发表于 2012-02-02 00:08 |只看该作者
谢谢分享

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
4 [报告]
发表于 2012-02-03 15:20 |只看该作者
  1. cmp a.txt b.txt
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP