Created
May 28, 2017 07:43
-
-
Save vardars/1c191aa249b97200382d4d4f17ea3598 to your computer and use it in GitHub Desktop.
Windows git hook commit message
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
#!/usr/bin/env python | |
import sys, re | |
from subprocess import check_output | |
branch = check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip() | |
commit_msg_filepath = sys.argv[1] | |
with open(commit_msg_filepath, 'r') as f: | |
content = f.read() | |
with open(commit_msg_filepath, 'w') as f: | |
f.write(branch + " - " + content) |
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/sh | |
python .git/hooks/commit-message.py $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment