I like the output formatting of git diff. The color and the +/- representation of changes between lines is easier to read than GNU di
Install colordiff.
Update your ~/.colordiffrc (copying /etc/colordiffrc first, if necessary):
# be more git-like:
plain=off
newtext=darkgreen
oldtext=darkred
diffstuff=darkcyan
Use colordiff -u file1 file2 for two files or colordiff -ruN path1 path2 for recursively comparing paths.
It's not exactly the same, but it's very close.
Use colordiff:
Installation:
sudo apt-get install colordiff
Usage:
colordiff -u file_one file_two
Gives exactly same difference as shown by git diff.
If you don't have colordiff or git diff, you can get color by vim.
cdiff() { diff -u $@ | vim -R -; }
or simply
cdiff() { diff -u $@ | view -; }
Tested in debian 9
diff -u --color=always file1 file2
Place this in your .bashrc or .zshrc :
diff() { git diff --no-index "$1" "$2" | colordiff; }
requirments : git and colordiff should be installed before-hand.
usage : diff file1 file2
example : for $diff .tmux.conf .zshrc.pre-oh-my-zsh
You can also use git diff --no-index -- A B (via manpage).