Skip to content

Instantly share code, notes, and snippets.

@andrewwoods
Last active September 18, 2015 21:21
Show Gist options
  • Save andrewwoods/534cbcc2c9f9069d4893 to your computer and use it in GitHub Desktop.
Save andrewwoods/534cbcc2c9f9069d4893 to your computer and use it in GitHub Desktop.
Custom Git Commit Message
Subject line
Describe what you did and why
[ticket: #X]
#------------------------------------------------@----------------------
#
# * Separate subject from body with a blank line
# * Limit the subject line to 50 characters
# * Capitalize the subject line
# * Do not end the subject line with a period
# * Write the subject line to sound like an authoritative command
# * Wrap the body at 72 characters
# * Use the body to explain what and why vs. how
#
#-----------------------------------------------------------------------
@andrewwoods
Copy link
Author

After reading the article at http://chris.beams.io/posts/git-commit/ I wanted to create a better default commit message. Particularly, I wanted to add some hints for the author.
Hints:

  • the length of the dashed lines are 72 characters
  • the @ is at the 50th column
  • the square brackets around the ticket information mean it's optional
    • if your commit doesn't refer to an issue, delete the entire line
    • if your commit refers to an issue, remove the square brackets and replace the X with your issue number

Download and Move this file to your home directory, and execute the following command.
$ git config --global commit.template ~/.git-commitmessage

@ieatkillerbees
Copy link

Excellent advice 👍

@jeremykendall
Copy link

💯

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