Skip to content

Instantly share code, notes, and snippets.

View cenobitedk's full-sized avatar
👨‍🚀
On a mission

Jeppe Hasseriis cenobitedk

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