Created
August 27, 2011 09:25
-
-
Save wezm/1175182 to your computer and use it in GitHub Desktop.
Strip trailing whitespace in modified files tracked by 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 ls-files --modified '*.[hm]' | xargs sed -i '.bak' 's/[[:space:]]*$//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I started getting this problem too. It happens when the files aren't in the top level of the project. I've come up with a shorter, better script as a result. Gist, updated.