Skip to content

Instantly share code, notes, and snippets.

@premkash
Created July 4, 2018 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save premkash/95ca6214223363ec7720463db1204058 to your computer and use it in GitHub Desktop.
Save premkash/95ca6214223363ec7720463db1204058 to your computer and use it in GitHub Desktop.
Template for git commit messages
# If this commit is applied, it will ...?
# Syntax:
# Commit Type: Subject (Max 50 chars)
#-----------------------------------------------|
# (optional body) (Max 72 chars)
# Explain the problem this commit is solving. Focus on why you are
# making this change as opposed to how (the code explains that).
#----------------------------------------------------------------------|
# (optional) Reference to tickets, wiki etc?. e.g.
# Resolves/Fixes: #23
# See also: #43, #45
#--------------------------------------------
# Commit Type may be :
# Feat (new feature)
# Fix (bug fix)
# Refactor (refactoring prod code)
# Style (formatting, missing semi colons, etc; no code change)
# Docs (change to documentation)
# Test (adding or refactoring tests; no prod code change)
# Chore//Nits (version bums, script etc; no prod code change)
# ... anything that your team agrees to.
# Source:
# https://chris.beams.io/posts/git-commit/
@premkash
Copy link
Author

premkash commented Jul 4, 2018

How to configure your git, so that it uses this template file when you want to write a commit message:

  1. Put this file in a global location, preferably user's home folder as ~/git-commit.template
  2. Add 'commit.template' config setting to git as:
    git config --global commit.template ~/git-commit.template
  3. Commit your changes as 'git commit' and you will be presented with a screen to type your commit message using this template.

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