Skip to content

Instantly share code, notes, and snippets.

@sergeynikiforov
Created August 22, 2016 06:37
Show Gist options
  • Save sergeynikiforov/e272f5acf874b306d10c59e60408cf58 to your computer and use it in GitHub Desktop.
Save sergeynikiforov/e272f5acf874b306d10c59e60408cf58 to your computer and use it in GitHub Desktop.
git hook to automatically prepend commit message with '<branch_name>: '
#!/bin/sh
#
# Automatically prepends commit message with a branch name.
#
NAME=$(git branch | grep '*' | sed 's/* //')
echo -n "$NAME"': '| cat - "$1" > /tmp/out && mv /tmp/out "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment