Skip to content

Instantly share code, notes, and snippets.

View PiotrNowicki's full-sized avatar

Piotr Nowicki PiotrNowicki

View GitHub Profile
@PiotrNowicki
PiotrNowicki / prepare-commit-msg
Created July 2, 2012 15:16 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/sh
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ]; then
echo "[$BRANCH_NAME] $(cat $1)" > $1
fi