Skip to content

Instantly share code, notes, and snippets.

@jodyheavener
Created July 16, 2020 15:18
Show Gist options
  • Select an option

  • Save jodyheavener/11fc2a80b3b246e18f178a8430cdea2f to your computer and use it in GitHub Desktop.

Select an option

Save jodyheavener/11fc2a80b3b246e18f178a8430cdea2f to your computer and use it in GitHub Desktop.
Git Commit Template
type(scope): subject
# Why is this change happening?
Because:
- ...
# What does this commit change?
This commit:
- ...
# Uncomment to specify the issue this commit addresses
# Closes #(issue number)
# Uncomment to specify co-authors
# Co-authored-by: Jody Heavener <j.heavener@gmail.com>
# Co-authored-by: Name <name@example.com>
# ## Help ##
#
# Commit type
#
# Should be one of:
#
# * feat: A new feature.
# * fix: A bug fix.
# * docs: Documentation only changes.
# * style: Changes that do not affect the meaning of the code
# (white-space, formatting, missing semi-colons, etc).
# * refactor: A code change that neither fixes a bug or adds a feature.
# * perf: A code change that improves performance.
# * test: Adding missing tests.
# * chore: Changes to the build process or auxiliary tools and
# libraries such as documentation generation.
#
# Scopes
#
# Could be anything specifying place of the commit change.
# For example `oauth`, `fxa-client`, `signup`, `l10n`, etc...
#
# Subject
#
# Contains succinct description of the change:
#
# * Use the imperative, present tense: "change", not "changed"/"changes".
# * Don't capitalize the first letter.
# * No period (.) at the end!
#
# Body
#
# * Use as many lines as you like.
# * Use 72 characters maximum per line for typical word wrap text.
#
# ---
#
# * Version: 1.0.0
# * Updated: 2020-07-16
# * Licence: Mozilla Public License 2.0 (MPL-2.0)

Git Commit Template

Based on joelparkerhenderson/git_commit_template with guidelines from mozilla/fxa.

How to use

  • Create the file ~/.git_commit_template with the template above (customized as you see fit) and save it.
  • Set the template in your Git config with one of two ways:
    1. In the command line: git config --global commit.template ~/.git_commit_template
    2. In your .gitconfig file:
    [commit]
      template = ~/.git_commit_template
    

Now, when you commit without the -m flag, your default editor will open with this template pre-populated as the message.

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