Linux: Use Git Diff as Diff Replacement

By Xah Lee. Date: .

You can use git diff instead of the normal unix/linux/gnu diff.

Advantages of using git diff:

Using Git for Diff

git diff --color --no-pager --no-index file1 file2
show differences between files, ignore git index (staged) file.

If the files are outside any git repository, then --no-index is not necessary.

By default, it output one page at a time.

Color and no pager can be turned on globally. See Git: Config

git diff 2022-11-17 J5RjD
git diff 2022-11-17

2013-06-14 big thanks to Yuri Khan on using git diff.

Linux, diff