Our dotfiles now include a git commit message template that encourages some best practices.
Download our git commit message template to your home directory:
curl https://raw.githubusercontent.com/cfpb/dotfiles/master/.gitmessage -o ~/.gitmessage
Tell git to use it:
git config --global commit.template ~/.gitmessage
Whenever you create a new commit, use git commit -a
(or just git ca
if you're using our aliases).
Git will open the message template in your default editor.
The template looks like this:
# 1. If applied, this commit will...
# 2. Explain why this change is being made
# 3. Provide links to any relevant issues, articles or other resources
#-----------------------------------------------@----------------------#
#
# 1. Commit summary. Keep it under 50 characters. @-symbol above is a
# marker for that. Don't end it with a period. Imperative mood.
#
# 2. Description of commit should explain WHY a change was made and
# lines should be wrapped to 72 characters; marked by the #-symbol.
#
# 3. Optionally, reference a GH issue number or other links.
#
# For more tips: http://chris.beams.io/posts/git-commit
#
Here's an example of a complete message: