Skip to content

Instantly share code, notes, and snippets.

@jeffutter
Created July 15, 2014 13:51
Show Gist options
  • Save jeffutter/98aa457874bc2100715a to your computer and use it in GitHub Desktop.
Save jeffutter/98aa457874bc2100715a to your computer and use it in GitHub Desktop.
Branch name in commit messages
#!/bin/sh
branch=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
trimmed=$(echo $branch | sed -e 's/^[^-]*\/\(.*\)/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' )
echo -n "[$trimmed]"' '|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