Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🚀
On a mission

Jeppe H. cenobitedk

👨‍🚀
On a mission
View GitHub Profile
@cenobitedk
cenobitedk / prepare-commit-msg
Last active Jan 30, 2019
[tdc] Prepare git commit message with issue id extracted from branch name, e.g. "feature/[ISSUE-123]-description..." => "ISSUE-123: ".
View prepare-commit-msg
#!/bin/sh
BRANCH=$(git symbolic-ref --short HEAD)
TRIMMED=$(echo $BRANCH | sed -e 's:.*/\([^/-]\+-[0-9]\+\).*:\1\: :')
sed -i.bak -e "1s/^/$TRIMMED/" $1