TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

From a useless Git Diff to a useful one

35 pointsby bitsweetover 11 years ago

8 comments

reidracover 11 years ago
The problem is not the diff but the &quot;and besides that&quot;.<p>You should make two different commits, changing indentation and changing a feature are different changes and should be tracked independently.
评论 #6642206 未加载
评论 #6642192 未加载
评论 #6642173 未加载
评论 #6645892 未加载
评论 #6643217 未加载
评论 #6642164 未加载
评论 #6643644 未加载
评论 #6643373 未加载
评论 #6643505 未加载
kyleslatteryover 11 years ago
Not sure if it does exactly the same thing, but on GitHub, if you add ?w=1 to the end of a diff URL, it&#x27;ll show it with whitespace ignored.
Groxxover 11 years ago
My personal favorite: --patience<p>It tends to produce more &quot;this looks like what I did&quot; diffs, with code at least.
SomeCallMeTimover 11 years ago
Or use a diff tool that can do this automatically..? [1] Diff without the ability to edit the changes you see is only about 10% as useful as the ability to edit those diffs inline, change how it&#x27;s decided to compare the two (or three) files (match THIS line with THIS OTHER line...), or trivially revert the changes a line at a time. [2]<p>I hop back and forth between GUI-based editors and the command line. Some things are just better in a GUI, and diff is one of those things--especially any nontrivial diff.<p>[1] <a href="http://www.scootersoftware.com/" rel="nofollow">http:&#x2F;&#x2F;www.scootersoftware.com&#x2F;</a><p>[2] I&#x27;m sure you can do this in vi and&#x2F;or emacs as well. I leave how to do that as an exercise to the reader.
评论 #6643104 未加载
jordighover 11 years ago
On Mercurial, all of those options are just &quot;hg diff -w&quot;.<p>You can also ignore whitespace when picking commits apart with hg record (akin to git add -p, I think).
ranmanover 11 years ago
Also everyone should be using tig: <a href="http://jonas.nitro.dk/tig/" rel="nofollow">http:&#x2F;&#x2F;jonas.nitro.dk&#x2F;tig&#x2F;</a>
philsnowover 11 years ago
I&#x27;d really like a diff option that ignores changes that don&#x27;t alter the AST.<p>That&#x27;s pretty outside the scope of git diff or gnu diff, though.
civilianover 11 years ago
An alias for bash<p><pre><code> gitdiff() { git diff --patience --ignore-space-at-eol -b -w --ignore-blank-lines $1 }</code></pre>
评论 #6642939 未加载
评论 #6642880 未加载