Skip to content

Instantly share code, notes, and snippets.

@matt-fff
Created December 13, 2018 22:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-fff/14eb5fbd68798bc1aa8179d96d1cc378 to your computer and use it in GitHub Desktop.
Save matt-fff/14eb5fbd68798bc1aa8179d96d1cc378 to your computer and use it in GitHub Desktop.
Apply Black formatting before every commit
git diff --cached --name-status | grep -v '^D' | grep '.py' | sed 's/[A-Z][ \t]*//' | xargs black 2>&1 | grep '^reformatted' | sed 's/reformatted[ \t]//' | xargs git add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment