Skip to content

Instantly share code, notes, and snippets.

View danlyh5288's full-sized avatar

danlyh5288

  • McGill University
  • Vancouver, British Columbia, Canada
View GitHub Profile
@gortok
gortok / pre-receive.py
Last active June 8, 2020 12:39
Python Pre Receive hook for checking commit messages
#!/bin/python
import sys
import re
import subprocess
#Format: "oldref newref branch"
line = sys.stdin.read()
(base, commit, ref) = line.strip().split()
new_branch_push = re.match(r'[^1-9]+', base)