Skip to content

Instantly share code, notes, and snippets.

@killshot13
Last active January 9, 2022 05:24
Show Gist options
  • Save killshot13/828ed70eb1e2f184733dc5e4aea97276 to your computer and use it in GitHub Desktop.
Save killshot13/828ed70eb1e2f184733dc5e4aea97276 to your computer and use it in GitHub Desktop.
my-commit-message-convention
##################################################
# TEMPLATE #
##################################################
[Subject:]
[Body:]
[References:]
##################################################
# EXAMPLE #
#
# Fix(middleware): ensure headers comply w/ RFC 2616
#
# Adds one new dependency, now uses `range-parser`
# (Express dependency) to compute range. It's also
# more tested in the wild.
#
# Fixes (#513, #522)
#
##################################################
# PARAMS #
##################################################
#
# <Type>(<scope>): <summary>
#
# Type (required) must be one of the following:
#
# [Build, Chore, Docs, Feat, Fix, Perf, Refactor,
# Style, Test, Update]
#
# Scope (optional) must be a lowercase noun.
#
# Summary (required) must lead with an imperative,
# lowercase verb and have neither capitalization
# nor punctuation.
#
# <Body>
#
# Body (optional) must be a detailed description
# of changes made and the rationale behind them,
# if needed. Use of multiple lines is permitted.
#
# <References>
#
# References (optional) must be brief and link to
# any open issues the commit fixes and/or closes.
#
##################################################

Git Commit Convention

Template

[Subject Line]

  [Multi-Line Body]

[Reference Line]

Syntax

<Type>(<scope>): <summary> 
(50 characters or less)

  <Details>

<Refs>

Parameters

[Type] -- assigns the commit to one of ten broad categories.

  • Required
  • Must use one of the following categories
  • Should begin with a capital letter followed by a colon

Build: changes the build process and/or dependencies

Chore: contains routine tweaks which don't affect the end-user

Docs: adds or updates the codebase documentation

Feat: introduces a new feature or capability

Fix: addresses a bug or security issue

Perf: improves build time/page load speed

Refactor: contains sematic rewrites or formatting

Style: adjusts or improves the UI/UX

Test: introduces a new test or updated test

Update: releases a new version of the source code


[Scope] -- identifies which portion of the codebase was modified, if applicable.

  • Optional
  • Must be a noun placed inside parentheses
  • Should appear inside [Type] by placing the colon after the closing parenthesis
  • Should be written in all lowercase

Examples:

(backend):

(server):

(middleware):

(jquery):


[Summary] -- provides a condensed description of the associated changes.

  • Required
  • Should begin with a present-tense, imperative verb
  • Should be written in all lowercase
  • Should have no end punctuation

Examples:

fixes to accomodate the new cap rule

corrects failing Jest test cases

allows fallthrough comments inside blocks


[Details] -- allows for additonal description about the commit and the changes made.

  • Optional
  • Must use discretion and consistency
  • Should be indented two spaces past the start of the subject line
  • Should be verbose but not tiresome
  • May be more than one line

[Refs] -- links to any open issues or tickets which the commit addresses.

  • Optional
  • Must be consistent across all commits
  • Should create a clickable link to the issue being tracked
  • Should include a label type where applicable
  • Should capitalize the first word
  • Should have no end punctuation

Examples:

Fix: (#513, #522)


Credit

Git Commit Message Convention That You Can Follow, Ishan Makadia

eslint/eslint, official repo, master branch

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