Skip to content

Instantly share code, notes, and snippets.

@LordZardeck
LordZardeck / prepare-commit-msg
Last active May 31, 2020 14:59
Git hook to prepend Active Collab GUIDs for tasks to the commit message. Requires branch names to contain the GUID, such as `feature/ABC-123_456-my-branch-feature`. To install, place the file in your project's `.git/hooks` directory
#!/bin/sh
ticket=$(git symbolic-ref HEAD | grep -e '[A-Z]\+-[0-9]\+_[0-9]\+' -o)
if [ -n "$ticket" ]; then
echo "$ticket - $(cat $1)" > $1
fi