Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created January 31, 2021 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save md2perpe/62cd98851db21010fad0c235946e5045 to your computer and use it in GitHub Desktop.
Save md2perpe/62cd98851db21010fad0c235946e5045 to your computer and use it in GitHub Desktop.
Prepare commit message for merge
#!/usr/bin/env python3
import sys
import fileinput
import re
if sys.argv[2] == "merge":
with fileinput.input(sys.argv[1], inplace=True) as f:
for line in f:
if line.startswith("Merge branch"):
print("Merge")
print()
for b in re.findall("'(.+?)'", line):
print(f"* {b}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment