Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
git add files ignoring whitespace
# props:
git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero

This comment has been minimized.

Copy link
Owner Author

@mmrko mmrko commented Sep 15, 2017

To add an alias (e.g. ganw) for it in your ~/.bashrc (or alike):

# ~/.bashrc
alias ganw="git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero"

source ~/.bashrc or open a new terminal tab to make it available.

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