Skip to content

Instantly share code, notes, and snippets.

@matthieuprat
Created January 20, 2016 09:36
Show Gist options
  • Select an option

  • Save matthieuprat/f6e22a75f7dbb0482698 to your computer and use it in GitHub Desktop.

Select an option

Save matthieuprat/f6e22a75f7dbb0482698 to your computer and use it in GitHub Desktop.
#!/bin/sh
git diff-index --cached --name-only -z HEAD |
xargs -0 git grep --cached -I --name-only -z -E '[[:space:]]$' -- :!'*.slim' |
xargs -0 sed -i '' -E 's/[[:space:]]+$//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment