Skip to content

Instantly share code, notes, and snippets.

@LordZardeck
Last active May 31, 2020 14:59
Show Gist options
  • Save LordZardeck/bf0eb67f7545157a3ea00cfec118d1de to your computer and use it in GitHub Desktop.
Save LordZardeck/bf0eb67f7545157a3ea00cfec118d1de to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment