Skip to content

Instantly share code, notes, and snippets.

@MikaelPikael
Created September 30, 2016 13:18
Show Gist options
  • Save MikaelPikael/2ec1c712435135a4ae73573f57ac95a5 to your computer and use it in GitHub Desktop.
Save MikaelPikael/2ec1c712435135a4ae73573f57ac95a5 to your computer and use it in GitHub Desktop.
Parse task number from git branch name and add it in your commit message
#!/bin/sh
#
task=$(git rev-parse --abbrev-ref HEAD | sed "s/_.*//")
echo "\n\n\n$task #review" > /tmp/commitmsg.txt
@MikaelPikael
Copy link
Author

MikaelPikael commented Sep 30, 2016

The pre-commit is located in your .git/hooks directory

You need to update your .git/config file with:

[commit]
template = /tmp/commitmsg.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment