Commit¶
Committing is the process of saving changes to a local repository. It is a fundamental part of version control and is used to track the history of changes in a project. Commits are accompanied by commit messages that briefly describe the changes.
1. Category¶
1.1. Conventional Commits¶
The Conventional Commits specification is a standardized convention for writing commit messages. It introduces a structured and semantic way to convey the purpose and nature of changes made in a commit. A Conventional Commit contains structural elements that communicate intent to consumers of an application or library.
Note
Conventional Commits are often used with automated Versioning tools to generate release notes and determine version bumps based on commit history.
-
Conventions and Standards
-
Type
The
typein Conventional Commits indicates the nature of the change being made. It is a required element that provides a high-level categorization of the commit, helping to convey the intent and impact of the changes to other developers and tools.-
featA new feature introduced to the codebase.
Note
Correlates with
MINORin Semantic Versioning. -
fixA bug fix or correction to existing functionality.
Note
Correlates with
PATCHin Semantic Versioning. -
!A commit that appends a
!after the type or scope indicates a breaking API change. ABREAKING CHANGEcan appear in commits of any type.Note
Correlates with
MAJORin Semantic Versioning. -
choreRoutine tasks, maintenance, or tooling changes that don't impact the user-facing features.
-
docsDocumentation-related changes, including updates or additions.
-
styleChanges that do not affect the meaning of the code, such as formatting or typographical error (typo).
-
refactorCode restructuring or changes that do not add new features or fix bugs.
-
testCreating, modifying, or removing testing procedures or test cases.
-
buildChanges related to the build system or external dependencies.
-
ciModifications to the continuous pipelines configuration and scripts.
-
perfPerformance improvements or optimizations.
-
revertReverting a previous commit.
-
-
Scope
The
scopein Conventional Commits is an optional element that provides additional context about the area of the codebase affected by the commit. It is enclosed in parentheses immediately following thetypeand serves to further categorize the commit, making it easier for developers and tools to understand the specific part of the project that is impacted. -
Description
The
descriptionin Conventional Commits is a concise summary of the changes made in the commit. It follows thetypeand optionalscope, separated by a colon and a space. The description should be brief yet informative, providing enough context for other developers to understand the purpose of the commit at a glance. -
Body
The
bodyin Conventional Commits is an optional section that provides a more detailed explanation of the changes made in the commit. It follows thedescriptionand is separated by a blank line. The body can include additional context, rationale, or any relevant information that helps other developers understand the intent and implications of the changes. -
Footer
The
footerin Conventional Commits is an optional section that appears at the end of the commit message. It is used to reference issues, pull requests, or any other relevant information related to the commit. The footer can also include aBREAKING CHANGEdeclaration if the commit introduces a breaking API change.
-
-
Examples and Explanations
-
Type
-
Scope
-
Description
-
Body
-
Footer
-
-
Tools and Frameworks
Tooling for Conventional Commits maintain a structured and consistent approach to version control, commit messages, and release management in software projects.
-
A tool that helps contributors adhere to Conventional Commit conventions by guiding them through the commit process and generating well-formatted commit messages.
-
An extension for Commitizen that allows projects to customize commit message prompts and styles according to their specific needs.
-
Automates versioning and package publishing based on the semantic meaning of commit messages. It determines the version bump and generates release notes.
-
A Command Line Interface (CLI) for Conventional Commits, providing a simple way to generate commit messages following the convention.
-
A tool for linting commit messages, ensuring they adhere to specified conventions. Used in conjunction with Conventional Commits and Git Hooks for automated enforcement.
-
2. References¶
- Sentenz Versioning article.
- Sentenz Changelog article.