Skip to content

Instantly share code, notes, and snippets.

@daviddmr
Last active May 4, 2018 14:15
Show Gist options
  • Select an option

  • Save daviddmr/23804d334c401600ad5436dfa5b10cbe to your computer and use it in GitHub Desktop.

Select an option

Save daviddmr/23804d334c401600ad5436dfa5b10cbe to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
# Include this script into file in directory (PROJECT)/.git/hooks/prepare-commit-msg
# Adapted by https://gist.github.com/shytikov/3132078
#
NAME=$(git branch | grep '*' | sed 's/* //')
TEXT=$(cat "$1" | sed '/^#.*/d')
echo "[$NAME]"' - '$(cat "$1" | sed '/^#.*/d') > "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment