Skip to content

Instantly share code, notes, and snippets.

@tommyvdv
Last active February 22, 2016 08:17
Show Gist options
  • Save tommyvdv/9abbf6b258f315091b3f to your computer and use it in GitHub Desktop.
Save tommyvdv/9abbf6b258f315091b3f to your computer and use it in GitHub Desktop.
Make tabs stand out in git.

Make tabs stand out in git

By default most git commands will make trailing whitespace stand out by marking it red. This makes it almost impossible to miss these when using git add -p, git diff, git show -p and the like.

marked trailing whitespace

We can fairly easily also achieve this effect for tabs.

marked tabs

Include the following line(s) into your git config:

…
[core]
  …
  whitespace = tab-in-indent diff --check,tab-in-indent
  …
…

Start a new bash session, find a git project, enter some random tabs in the mix and see what you're about to commit: git diff.

Or add your changes with git add -p and use the interaction to step through the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment