Instantly share code, notes, and snippets.

Embed
What would you like to do?
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