Skip to content

Instantly share code, notes, and snippets.

@damirm
Created March 12, 2019 16:02
Show Gist options
  • Save damirm/a5b0ee73eb81f9ff8119ba749ac6e92a to your computer and use it in GitHub Desktop.
Save damirm/a5b0ee73eb81f9ff8119ba749ac6e92a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Usage:
# $ git commit -m "$(t): Commit message"
#
# Where "t" it's provided script below. It should be in $PATH.
ISSUE_RE="[A-Z]+-\d+"
ISSUE=$(git symbolic-ref --short HEAD 2>&1 | grep -Eo ${ISSUE_RE})
if [ -n "${ISSUE}" ]; then
echo "${ISSUE}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment