Search code examples
macosgitdiffinteractive-mode

Git diff: Write output and exit instead of interactive mode


When I run git diff on my OSX command line, the output is displayed inside a less or vim interface. The interface lets me to scroll up and down, and quit using the q key.

This is very annoying, especially when there is no diff and git opens a blank screen.

Can I just write the diff (color) output the the screen without entering the interactive mode?


Solution

  • 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