Skip to content

Instantly share code, notes, and snippets.

@contolini
Last active March 1, 2017 18:26
Show Gist options
  • Save contolini/4739b752bf44c45c46a2e1831425068e to your computer and use it in GitHub Desktop.
Save contolini/4739b752bf44c45c46a2e1831425068e to your computer and use it in GitHub Desktop.

Our dotfiles now include a git commit message template that encourages some best practices.

How to use our template

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.

Example

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:

commit message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment