Comparing and Merging Files with GNU diff and p...

本文详细介绍了GNU diff工具的使用方法,特别是如何通过显示文件差异的上下文来帮助理解变更的具体内容。文章还讨论了如何使用统一格式和上下文格式来展示文件间的差异,并解释了如何在分发文件的新版本时,利用这些格式便于他人应用差异。

http://www.network-theory.co.uk/diff/manual/

Picture of Cover

Comparing and Merging Files with GNU diff and patch
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
ISBN 0954161750
RRP £12.95 ($19.95)
"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>
Comparing and Merging Files with GNU diff and patch

Buy the book here! >>>
learn more

2.3 Showing Differences in Their Context
Usually, when you are looking at the differences between files, you will also want to see the parts of the files near the lines that differ, to help you understand exactly what has changed. These nearby parts of the files are called the context.

GNU diff provides two output formats that show context around the differing lines: context format and unified format. It can optionally show in which function or section of the file the differing lines are found.

If you are distributing new versions of files to other people in the form of diff output, you should use one of the output formats that show context so that they can apply the diffs even if they have made small changes of their own to the files. patch can apply the diffs in this case by searching in the files for the lines of context around the differing lines; if those lines are actually a few lines away from where the diff says they are, patch can adjust the line numbers accordingly and still apply the diff correctly. See section 10.3 Applying Imperfect Patches, for more information on using patch to apply imperfect diffs.

<<< previous table of contents next >>>

转载于:https://my.oschina.net/tadcat/blog/147782

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值