Skip to content

Instantly share code, notes, and snippets.

@jasonaowen
Last active December 30, 2015 12:59
Show Gist options
  • Save jasonaowen/7833242 to your computer and use it in GitHub Desktop.
Save jasonaowen/7833242 to your computer and use it in GitHub Desktop.
a git commit template for GitHub
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# ==[ Title: short meaningful description ]=====|
# The title needs to be fewer than 50 characters.
# ==[ Blank: Follow the Subject with a blank line, do NOT remove ]=====|
# ==[ Details: Describe what changed and explain why it changed ]======|
# This and all following lines should be fewer than 72 characters.
# Explain the reason behind your change!
# https://help.github.com/articles/github-flavored-markdown
# ==[ Issue: issue number and title ]==================================|
# Github will automatically link issues of the form #1 or user/repo#1
#Issue #
#
# Write your commit messages in the imperative: "Fix bug" and not
# "Fixed bug" or "Fixes bug." This convention matches up with commit
# messages generated by commands like git merge and git revert.
# - http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
wget -O ~/.commit-template https://gist.githubusercontent.com/jasonaowen/7833242/raw/.commit-template
git config --global commit.template ~/.commit-template
@nibalizer
Copy link

why is line 19 uncommented?

@jasonaowen
Copy link
Author

@nibalizer: The theory is that every commit should be contributing to an issue. Having it commented out makes it easier to forget and harder to add the issue number. It also induces a twinge of guilt when I delete the line because I'm not working on an issue, which I find valuable.

@jasonaowen
Copy link
Author

On further reflection, having an uncommented line is probably the wrong thing. It turns out that git is smart enough to notice if you've edited your commit message and will ignore the uncommented line if you make no changes, but that's not an obvious behavior, so I've commented the line out.

@nwbt
Copy link

nwbt commented Feb 3, 2014

I like it, thanks. It is also nice there is an option in git to config withOUT the global option.

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