If you'd like to have the output of git diff
, git diff --staged
etc. cleaned up after showing, instead of cluttering the terminal window, change the pager config as follows:
git config --global core.pager 'less -+X -+F'
As a result, each call to the above commands will be listed in a separate "window", which does not go into the Terminal history. You navigate it using u
or d
, and close it with q
.
The downside to this is if you mess something up or lose some code, if you had it in your old git diffs, you could find it in the Terminal and restore the code from there. So be careful.
Here's how you can check your current global git config:
git config --global --list