setting tabwidth to 4 in git show / git diff setting tabwidth to 4 in git show / git diff bash bash

setting tabwidth to 4 in git show / git diff


I believe git config --global core.pager 'less -x1,5'

References:


As the answer https://stackoverflow.com/a/10584237/1850340 did not work for me because of my color settings I came up with following solution:

TAB=$'\t' && git config --global core.pager "sed 's/$TAB/    /g' | less" && unset TAB

This replaces all tab characters with 4 spaces before displaying it with less.(The TAB workaround is needed to circumvent the shells backslash escape)