Colordiff

From Bonus Bits
Jump to: navigation, search

Description

This article gives example commands for colordiff CLI tool.


Brief

Only indicate if there is a difference between two files

colordiff -q /path/to/file1 /path/to/file2


Ignore All Space

Ignore all white space

colordiff -w /path/to/file1 /path/to/file2


Ignore Blank Lines

Ignore diff of blank lines

colordiff -B /path/to/file1 /path/to/file2


List Diffs with Line Numbers

List only changed lines, their line number and the diff.

colordiff --unchanged-line-format="" --new-line-format="%dn: %L" /path/to/file1 /path/to/file2


Side-by-Side Columns

Color diff with side by side columns.

colordiff -y /path/to/file1 /path/to/file2


Side-by-Side Columns Suppress Common Lines

Color diff with side by side columns suppress common lines.

colordiff -y --suppress-common-lines /path/to/file1 /path/to/file2


Side-by-Side Auto Column Widths

Color diff with side by side auto sized columns.

colordiff -yW"`tput cols`" /path/to/file1 /path/to/file2

Alias Example

alias cdiff-ac="colordiff -yW`tput cols` --suppress-common-lines"


Side-by-Side Auto Column Widths and Suppress Common Lines

Color diff with side by side auto sized columns.

colordiff -yW"`tput cols`"  --suppress-common-lines /path/to/file1 /path/to/file2

Alias Example

alias cdiff-acs="colordiff -yW`tput cols` --suppress-common-lines"


Diff of All Files Recursively

List all the files that are different between two directories recursively.

colordiff -qr /path/to/dir1 /path/to/dir2


Sources