icdiff: side-by-side diff
• 204 words • 1 min • updated
⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.
icdiff is a simple diffing tool written in
python by Jeff Kaufman that comes with two sensible
out-of-the-box defaults:
- colored diff output
- side-by-side diff
The usual diff tool in Unix system has some basic color support1.
Nonetheless, sometimes the output of icdiff is better, with little effort or
memorization.
Given two files (pardon my lack of creativity, but at least you know it’s not AI generated):
shell
% cat first
gustavo
fring
walter
white
% cat second
walter
white
jesse
pinkmanPlain diff output (terrible, IMHO):
shell
% diff first second
1,2d0
< gustavo
< fring
4a3,4
> jesse
> pinkmanBetter diff output:
shell
% diff --color=auto -uN first second
--- first 2024-07-09 10:50:01
+++ second 2024-07-09 10:50:08
@@ -1,4 +1,4 @@
-gustavo
-fring
walter
white
+jesse
+pinkman…which is why I have alias diff="diff --color=auto -uN" in my shell config /
dotfiles.
With icdiff:
shell
% icdiff first second
first second
gustavo
fring
walter walter
white white
jesse
pinkmanTwo observations:
- in this blog you cannot see the colors, therefore this example is meh
icdiffwill happily utilize your full terminal width, positioning the second column quite to the right in case, thereby fully utilizing the available space
-
And there’s also
colordiff. ↩︎
Backlinks
- Online diff tool (Dec 22, 2024)