Last active
October 13, 2017 07:01
-
-
Save jasonm23/7c0c064d6c1618f5ad5208d543ca1e1a to your computer and use it in GitHub Desktop.
Scrub trailing whitespace from your changed files under git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git status -s | cut -c3- | while read filename | |
do | |
sed -ibak 's/ *$//' "$filename" | |
done | |
echo "trailing whitespace cleaned" | |
git clean -fd **/*bak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment