Skip to content

Instantly share code, notes, and snippets.

View kevindb's full-sized avatar

Kevin Morris kevindb

View GitHub Profile
@kevindb
kevindb / prepare-commit-msg
Last active June 13, 2025 16:57
Prepend commit message with ticket number from branch name
#!/usr/bin/env python3
# https://gist.github.com/kevindb/a360c8e90bcdf6364f1523a5787c8d89
import sys, re
from subprocess import check_output
commit_msg_filepath = sys.argv[1]
branch = check_output(['git', 'branch', '--show-current']).decode('utf-8').strip()