TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Developer tool 'diff' is 40 years old: can it be improved?

25 点作者 MilnerRoute9 个月前

8 条评论

sevensor9 个月前
&gt; Or maybe you prefer to code with the classic old-school text editors, like vi (2012), Sublime Text (2008), or vim (1991)<p>Huh, vi was introduced 15 years after I first used it. Must have been inspired by vim. Think I’ll stop reading here.
评论 #41366454 未加载
评论 #41363853 未加载
评论 #41366539 未加载
JoeAltmaier9 个月前
We had, back in the &#x27;90s, a &#x27;semantic diff&#x27; that ignored whitespace, knew about programming languages, showed only significant code changes (not comments; not empty lines; not refactoring of code into a different number of lines). All I used after that.
评论 #41364805 未加载
skp19959 个月前
isn&#x27;t difftastic the new way to do this? <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39778412">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39778412</a><p>I highly recommend trying it out.
评论 #41363701 未加载
ilyagr9 个月前
- <a href="https:&#x2F;&#x2F;github.com&#x2F;dandavison&#x2F;delta">https:&#x2F;&#x2F;github.com&#x2F;dandavison&#x2F;delta</a> is nice for a prettier presentation of the same information as `git diff`.<p>- This may or may not qualify, since I think GNU diff supports it with an option, as does Git diff, but &quot;Color-words&quot; diff can be nice, where changes in the middle of the line are highlighted and whitespace is ignored.<p>- Somebody already recommended <a href="https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic">https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic</a>, which I second. It uses treesitter and is very interesting. Surprisingly, in practice difftastic is not always noticeably better than color words diff (don&#x27;t expect miracles), but occasionally it is much better.<p>For the last two, see Difftastic&#x27;s FAQ, <a href="https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic#isnt-this-basically---word-diff---ignore-all-space">https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic#isnt-this-basically---...</a><p><i>Update:</i> Finally, this blog post about difftastic describes some details: <a href="https:&#x2F;&#x2F;www.wilfred.me.uk&#x2F;blog&#x2F;2022&#x2F;09&#x2F;06&#x2F;difftastic-the-fantastic-diff&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.wilfred.me.uk&#x2F;blog&#x2F;2022&#x2F;09&#x2F;06&#x2F;difftastic-the-fan...</a><p><i>Update 2:</i> Finally finally, Difftastic&#x27;s wiki has more related tools: <a href="https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic&#x2F;wiki&#x2F;Structural-Diffs">https:&#x2F;&#x2F;github.com&#x2F;Wilfred&#x2F;difftastic&#x2F;wiki&#x2F;Structural-Diffs</a>. Difftastic&#x27;s author writes many interesting things, it seems :).
OhMeadhbh9 个月前
I think diff is at least 50 years old. It shows up in the unix v5 source from 1974.<p><a href="https:&#x2F;&#x2F;minnie.tuhs.org&#x2F;cgi-bin&#x2F;utree.pl?file=V5&#x2F;usr&#x2F;source&#x2F;s1&#x2F;diff1.c" rel="nofollow">https:&#x2F;&#x2F;minnie.tuhs.org&#x2F;cgi-bin&#x2F;utree.pl?file=V5&#x2F;usr&#x2F;source&#x2F;...</a>
stuaxo9 个月前
It would be great if this were accompanies by a patch to diff itself.
hulitu9 个月前
&gt; Developer tool &#x27;diff&#x27; is 40 years old: can it be improved?<p>Fix the bugs first, please.
pipeline_peak9 个月前
I think I need a tldr for a 12 year old because my answer to that question is: does it need to be improved?<p>Diff, like all the original Unix tools was only meant to do one thing, compare two files. The beauty in that being that it can be a core component of whatever you want.<p>UI extensions, algorithm adjustability to name some. But based on what Myers mentioned as someone else said, “improved diff” is partially a semantic diff. One that’s less cold blooded about trivial changes like white spaces.<p>I don’t mean to be the typical pedantic HN commenter but that sounds like a diff of commit objects rather than files.