How to change tab width in git diff? [duplicate]

This actually has nothing to do with git diff.

git diff actually renders a tab, which is later converted by your terminal emulators (for instance, gnome-terminal) to spaces.

Go to the preference of your terminal emulator to change that setting.


Also, git may use a pager, so you might want to configure it like that:

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

More information here: setting tabwidth to 4 in git show / git diff

Leave a Comment