Last active
June 19, 2019 08:41
-
-
Save alper/22aadce3015cb15c3eafc667cdf4ae79 to your computer and use it in GitHub Desktop.
A git hook that checks whether there is an issue number in the first line of your commit message
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 python3 | |
import sys | |
commit_msg_filepath = sys.argv[1] | |
with open(commit_msg_filepath, 'r+') as fh: | |
lines = fh.readlines() | |
if '#' not in lines[0]: | |
print("No issue number in first line of commit message. Stopping.") | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment