Skip to content

Instantly share code, notes, and snippets.

@koic
Last active November 14, 2016 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koic/4e0f6ea8870ef1ca935ee3d8ea04c855 to your computer and use it in GitHub Desktop.
Save koic/4e0f6ea8870ef1ca935ee3d8ea04c855 to your computer and use it in GitHub Desktop.
git hook for an anti patterns of commit message
#
# コミットメッセージアンチパターン: 「コメント対応」メッセージ
#
# 「コメント対応」というコミットメッセージではコミットをできないようにする hook です。
# gitメッセージのサマリとなる1行目が対象です。
#
# このファイルの内容を .git/hooks/commit-msg に配置することで有効になります。
#
if [ "$(head -1 $1 | grep 'コメント対応')" ]; then
echo "\033[0;31m[ABORT] コミットメッセージには変更に対する「なぜ」を書きましょう。\033[0;39m" 1>&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment