Git Commit Messages in Vim
A colleague stumbled upon Chris Beam’s “How to Write a Git Commit Message” post yesterday. His suggestions might not be to everyone’s tastes (see the comments at the end), but I certainly found them useful. In particular, I liked the suggestion that commit messages should be multi-lined and that no commit should be greater than 72 characters.
Use the following to configure vim to wrap commit messages at 72 characters:
cat >> ~/.vimrc <<EOF
au FileType gitcommit set tw=72
EOF
And, if you haven’t already, set vim as your git editor:
git config --global core.editor vim