Here is a prepare-commit-msg hook to make commit messages from ChangeLog
entries.
Paolo
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by git-commit with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, make this file executable.
make_changelog ()
{
git diff "$@" -- ChangeLog | sed -n \
-e '/^@@/,/^+/ {' \
-e ' s/^ //p' \
-e ' t' \
-e '}' \
-e '/^diff/,/^@@/ d' \
-e 's/^+ //p' \
-e t | sed -e '1,/^./!b' -e '//!b' -e '/^\*/{;x;p;p;x;b;}' -e 'p;x;p;x;d'
}
case "$2${3+ }$3" in
merge)
sed -i '/^Conflicts:/,/#/!b;s/^/# &/;s/^# #/#/' "$1" ;;
"")
(echo; echo; make_changelog --cached; grep '^.' "$1") > "$1".tmp
mv "$1".tmp "$1" ;;
*) ;;
esac