Last active
October 5, 2021 10:17
-
-
Save jon-ruckwood/1af7f8c31db89733fa53c33ff5c1b4b6 to your computer and use it in GitHub Desktop.
Git config and hook to add trailer automatically to commit messages
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
# Requires branch named in format `zz/key-1234/some-short-desc | |
# Results in commit with trailer: | |
# TASK: KEY-1234 | |
# | |
[trailer "task"] | |
key = "Task: " | |
ifExists = replace | |
ifMissing = add | |
cmd = git rev-parse --abbrev-ref HEAD | awk -F/ '{ print toupper($2) }' | |
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 | |
COMMIT_MSG_FILE=$1 | |
COMMIT_SOURCE=$2 | |
SHA1=$3 | |
git interpret-trailers --in-place "$COMMIT_MSG_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment