[jbosstools-dev] Git tip for comparing small changes/documents

Max Rydahl Andersen manderse at redhat.com
Thu Jan 9 08:43:29 EST 2014


so this is just a FYI/tip on git.

While looking at this diff it occurred to me worddiff is much nicer to 
compare these changes than normal diff used by git and github.

If you have this PR checked out you can do:

`git diff 4.40.x`

which gives you:
http://screencast.com/t/KRat75Yy
(you got tons of duplicated lines even though in this case its just a 
few parts of the line that has changed.

In comes word diff:
git diff --word-diff 4.40.x

which gives you:
http://screencast.com/t/gmrBCmRfEKI

Now no duplicated lines and you can more easily spot what changed.

But you can even go further:
git diff --word-diff-regex=. --color-words 4.40.x

which gives you:
http://screencast.com/t/nGpbD9EQ7B

Now its just the character diffs.

ps. you can remove --color-words if you like to have the {+} {-} but I 
find it a bit too noisy at this level.

This word-diff is especially good to comparing textual documents as 
oppose to code where the normal line diff often are better.

Just thought I would share that little time saver.

/max


More information about the jbosstools-dev mailing list