Skip to content

Instantly share code, notes, and snippets.

View cbporch's full-sized avatar
💻

Christopher Porch cbporch

💻
View GitHub Profile
@cbporch
cbporch / commit-msg
Last active April 8, 2022 14:41
commit-msg: Prepend Jira ID to a commit in a git hook that Pycharm will execute
#!/bin/sh
#
# Automatically prepends branch name to every commit message
# if the branch name has a prefix with a Jira ticket id, i.e. FOO-123/my-branch.
#
# Get and clean up the present branch name, then grep it for a format similar to Jira ticket IDs
NAME=$(git branch | grep '\* ' | sed 's/* \((no branch, rebasing \)\{0,1\}//' | sed 's/\/.*//' \
| tr "[:lower:]" "[:upper:]" \
| grep -E "[A-Z]{2,10}-\d{1,6}")

Keybase proof

I hereby claim:

  • I am cbporch on github.
  • I am cbporch (https://keybase.io/cbporch) on keybase.
  • I have a public key ASCgTBmFipM8_YMDOdLH5t-nZC2oRtfBWtdVni6yNQJFTgo

To claim this, I am signing this object: