Created
March 10, 2022 08:43
-
-
Save Kludex/b4a93523ea067ed72e24c740f3ac2527 to your computer and use it in GitHub Desktop.
Script that adds "[A-B] " as prefix, considering a branch called "A-B-other-stuff"
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 subprocess | |
import sys | |
branch_name = subprocess.check_output("git rev-parse --abbrev-ref HEAD".split()).decode().strip() | |
jira_ticket = "-".join(branch_name.split("-")[:2]) | |
commit_msg = f"[{jira_ticket}] {sys.argv[1]}" | |
sys.argv[1] = commit_msg | |
gcmsg_args = sys.argv[1:] | |
subprocess.run(["git", "commit", "-m", *gcmsg_args]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment