til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

One-time Disable of diff-so-fancy for Git

The pager diff_so_fancy is very nice and renders beautiful diffs to your terminal.

The below tip works if you have diff-so-fancy configured as your pager in your Git config.

Sometimes you have to communicate the diff via some other medium, where the coloring and layout is lost when the diff is converted to basic text. So just pasting diff-so-fancy output is not always so fancy and important information is lost in the process.

You can disable the use of the pager for Git quite easily and return to regular diff formatting on the command line by using the git command line option: --no-pager

$ git --no-pager diff

Since it is one-time, diff-so-fancy works as expected when just doing:

$ git  diff

Do note that the –no-pager is an option to the git command and not git diff, so the order is important.

References