Skip to content

Instantly share code, notes, and snippets.

@kujiy
Created September 15, 2015 10:15
Show Gist options
  • Save kujiy/651c6931c4b5e0eff815 to your computer and use it in GitHub Desktop.
Save kujiy/651c6931c4b5e0eff815 to your computer and use it in GitHub Desktop.
Git hook / A commit-msg for add branch name to commit message
#!/bin/sh
#ブランチ名を取得
Branch="$(git rev-parse --abbrev-ref HEAD)"
#コミットメッセージの最初にブランチ名を追加
mv $1 $1.tmpbycommit-msg
echo -n "[$Branch] " > $1
cat $1.tmpbycommit-msg >> $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment