Disable the interactive pager with the --no-pager
option.
Usage: git --no-pager diff
(note how it's not specific to git-diff, so it's usable with any git command!)
Documentation: https://git-scm.com/docs/git
Copied from https://stackoverflow.com/a/2183920/2221472