Last active
July 21, 2018 04:18
-
-
Save ericdill/9940af172138f54b37e62003eb278810 to your computer and use it in GitHub Desktop.
Pre-commit hook that reformats your code according to yapf
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/bash | |
# capture the changed files that have been staged | |
changed_files=$(git diff --staged --name-only) | |
echo "Changed files: ${changed_files}" | |
for file in ${changed_files} | |
do | |
echo "Modifying ${file}" | |
yapf ${file} -i | |
git add ${file} | |
done |
Author
ericdill
commented
Feb 15, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment