Skip to content

Instantly share code, notes, and snippets.

@ShayanTheNerd
Last active July 27, 2025 13:26
Show Gist options
  • Save ShayanTheNerd/a727c9c52fa6ecd11c073c1f391567ce to your computer and use it in GitHub Desktop.
Save ShayanTheNerd/a727c9c52fa6ecd11c073c1f391567ce to your computer and use it in GitHub Desktop.
Git commit message template
# ====================================== Template =======================================
# <type>[(scope)][!]: <summary> (maximum 50 characters)
# [body]: Explain WHY you are making this change, not HOW. (wrap lines at 72 characters)
# [footer]
# Signed-off-by: <name> (<email address>)
# Reviewed-by: <name> (@<GitHub username>)
# References/Fixes: #<GitHub issue number>
# =======================================================================================
# =================================== Commit Message ====================================
# =======================================================================================
# ==================================== Specification ====================================
# https://conventionalcommits.org - <required field> - [optional field]
# Remember to:
# - not capitalize the subject line, nor end it with a period;
# - separate subject, body, footer, and paragraphs with a blank line;
# - start multi-line bullet points with 2 whitespaces followed by "-";
# - use the imperative, present tense (e.g., "fix" not "fixed" nor "fixes").
# | Type | Description |
# | ----------- | --------------------------------------------------------------------- |
# | fix | Correction of bugs or issues |
# | feat | Introduction of a new feature |
# | revert | Reversion to a previous commit |
# | docs | Changes or additions to the documentation |
# | ci | Changes to CI configuration files or scripts |
# | style | Code style changes that don't affect functionality |
# | chore | Minor maintenance activities — no production code change |
# | refactor | Code revisions and improvements — no production code change |
# | test | Addition or refactoring of tests — no production code change |
# | build | Changes that affect the build system or external dependencies |
# | perf | Optimizations that improve the performance of production code |
# =======================================================================================

Global

Create a .gitmessage file next to your global .gitconfig file, and copy the gist into it. Then, run this command:

git config --global commit.template ".gitmessage"

Local

Create a .gitmessage file at the root of your project, and copy the gist into it. Then, add this script to your package.json file:

{
  "scripts": {
    "set:gitmessage": "git config --local commit.template \".gitmessage\""
  }
}

Run set:gitmessage in the prepare/postinstall script to automatically set it up after installing the dependencies.

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