Skip to content

Instantly share code, notes, and snippets.

@RollMan
Last active April 28, 2020 04:51
Show Gist options
  • Select an option

  • Save RollMan/61b18f2784d2f791fa3003a0e1725517 to your computer and use it in GitHub Desktop.

Select an option

Save RollMan/61b18f2784d2f791fa3003a0e1725517 to your computer and use it in GitHub Desktop.
python_autoformat_git_commit.sh
#!/bin/sh
# https://yoshinorin.net/2018/01/07/git-pre-commit-code-format/
for FILE in `git diff --staged --name-only --diff-filter=ACMRTUB | grep .py`; do
yapf -i $FILE
git add $FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment