Skip to content

Instantly share code, notes, and snippets.

@daviseford
Created July 3, 2018 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daviseford/413dc216007945a225b5079adcd1e742 to your computer and use it in GitHub Desktop.
Save daviseford/413dc216007945a225b5079adcd1e742 to your computer and use it in GitHub Desktop.
prepend's your git branch's name to the commit message
#!/bin/sh
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
echo "$NAME"': '$(cat "$1") > "$1"
if [ -n "$DESCRIPTION" ]
then
echo "" >> "$1"
echo $DESCRIPTION >> "$1"
fi
@daviseford
Copy link
Author

Save as commit-msg in your project's .git/hooks/directory.

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