Skip to content

Instantly share code, notes, and snippets.

@jaeyson
Last active August 12, 2021 06:44
Show Gist options
  • Save jaeyson/d3a7e7a399f70f0bcd4eb65978001a37 to your computer and use it in GitHub Desktop.
Save jaeyson/d3a7e7a399f70f0bcd4eb65978001a37 to your computer and use it in GitHub Desktop.
commit message template for git

1. Create a template

# ----------------------------------------------------------
# Header - (type): Brief description
# ----------------------------------------------------------
#   * feat         A new feature
#   * fix          A bug fix
#   * docs         Changes to documentation only
#   * style        Style/format changes (whitespace, etc.)
#   * refactor     Changes not related to a bug or feature
#   * perf         Changes that affects performance
#   * test         Changes that add/modify/correct tests
#   * build        Changes to build system (configs, etc.)
#   * ci           Changes to CI pipeline/workflow
# ----------------------------------------------------------


# ----------------------------------------------------------
# Body - More detailed description, if necessary
# ----------------------------------------------------------
#   * Motivation behind changes, more detail into how 
# functionality might be affected, etc.
# ----------------------------------------------------------


# ----------------------------------------------------------
# Footer - Associated issues, PRs, etc.
# ----------------------------------------------------------
#   * Ex: Resolves Issue #207, see PR #15, etc.
# ----------------------------------------------------------

2. Git global config

add this:

git config --global commit.template /path/to/commit_template_file

or directly edit it:

git config --global --edit

then add:

...
[commit]
        template = /path/to/commit_template_file
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment