Skip to content

Instantly share code, notes, and snippets.

@debashishc
Last active September 15, 2024 11:07
Show Gist options
  • Save debashishc/2c9525de5b9f2226ee584c4b16778d2c to your computer and use it in GitHub Desktop.
Save debashishc/2c9525de5b9f2226ee584c4b16778d2c to your computer and use it in GitHub Desktop.
Structured Git Commit Message
# <type>(<scope>): <subject>
#
# <body>
#
# <footer>
#
# Types:
# feat (new feature)
# fix (bug fix)
# docs (changes to documentation)
# style (formatting, missing semi colons, etc; no code change)
# refactor (refactoring production code)
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
#
# Scope:
# Anything specifying place of the commit change (optional)
# Examples:
# auth (authentication related changes)
# db (database related changes)
# api (API related changes)
# ui (user interface changes)
# config (configuration changes)
# perf (performance improvements)
# deps (dependency updates)
# i18n (internationalization/localization changes)
# security (security-related changes)
# ci (continuous integration related changes)
#
# Subject:
# Short description of the change in present tense. Not capitalized. No period at the end.
#
# Body:
# More detailed description of the change (optional). Use blank lines to separate paragraphs.
#
# Footer:
# References to issue trackers, breaking changes, etc. (optional)
#
# Example:
# feat(auth): add password reset functionality
#
# Implement a secure password reset flow using email verification.
# - Add PasswordResetController
# - Create email templates for reset instructions
# - Update user model with reset token field
#
# Closes #123
@debashishc
Copy link
Author

This template includes:

  1. The basic structure for the commit message
  2. Comments explaining each part of the template
  3. A list of common commit types
  4. Guidelines for writing the scope, subject, body, and footer
  5. An example of a complete commit message

To use this template:

  1. Save the content of this gist to a file named .gitmessage in your home directory.
  2. Configure git to use this template by running:
git config --global commit.template ~/.gitmessage    

Now, when you run git commit without the -m flag, your default editor will open with this template.

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