Skip to content

Instantly share code, notes, and snippets.

@Xvezda
Forked from median-man/.gitmessage
Last active September 27, 2021 07:29
Show Gist options
  • Save Xvezda/ff02c8d34df912b256433c4afdc72369 to your computer and use it in GitHub Desktop.
Save Xvezda/ff02c8d34df912b256433c4afdc72369 to your computer and use it in GitHub Desktop.
This commit message template helps you write **useful** commit messages.
# <type>: <subject>
# Using a Maximum Of 50 Characters ------------->|
# Try To Limit Each Line to a Maximum Of 72 Characters --------------->|
# Explain how the commit addresses the issue
# ^-- NOTE: The line above is emptied by intended
# Enter commit message below
# --- COMMIT END ---
# Type can be
# feat (new feature)
# fix (bug fix)
# refactor (refactoring production code)
# style (formatting, missing semi colons, etc; no code change)
# docs (changes to documentation)
# test (adding or refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
# wip (work in progress commit to be squashed -- do not push!)**
# --------------------
# Remember to
# - Capitalize the subject line
# - Use the imperative mood in the subject line
# - Do not end the subject line with a period
# - Separate subject from body with a blank line
# - Use the body to explain what and why vs. how
# - Can use multiple lines with "-" for bullet points in body.
#

.gitmessage

This is the template I came up with to help me improve the quality of my commit messages by using a template.

Usage

Use as a default template: Better Commit Messages with a .gitmessage Template

Use in prepare-commit-msg git-hook: Atlassian: Git Hooks

Use as a template for a repository:

  1. Save the template in the repository as .gitmessage. (Use your own naming if you wish.)
  2. In your terminal, cd to the project root.
  3. Run git config commit.template '<path>/.gitmessage'. Replace path with the relative path to the directory for the template.
  4. Use git commit without the -m option to make a commit with the template.

Further Reading

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