-
-
Save melizeche/2976193406997ac087557e2e4c1b25c1 to your computer and use it in GitHub Desktop.
Git Hook: Example post-merge hook that checks for updates to requirements.txt
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
import subprocess | |
diff_requirements = 'git diff ORIG_HEAD HEAD --exit-code -- requirements.txt' | |
exit_code = subprocess.call(diff_requirements.split()) | |
if exit_code == 1: | |
print 'The requirements file has changed! Remember to install new dependencies.' | |
else: | |
print 'No new dependencies.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this hook:
Copy it to
.git/hooks/post-merge
Ensure it's executable with
chmod +x .git/hooks/post-merge