Commit Message rules for TYPO3 CMS¶
Git and related tools work best when following a certain guideline for commit messages. A deeper introduction on git revision log conventions is helpful to understand the scope.
A commit message might look like this:
[BUGFIX] Short summary of changes introduced by this patch Most importantly, describe what is changed with the commit and not what is has not been working (that is part of the bug report already). More detailed explanatory text, if necessary. Wrap it to 74 characters. The first line is treated as the subject of the commit message and the rest of the text as the body. The blank line separating the subject from the body is critical (unless you omit the body entirely); tools like git rebase can get confused if you run the two together. Write your commit message in the '''imperative present tense''' ("Fix bug", not "Fixed bug"). This convention matches up with generated commit messages by commands like git merge and git revert. Help others to understand what you did (Motivation for the change? Whats the difference to the previous version?), but keep it simple. Problem description as well as testing and/or reproduction instructions shall be part of the Forge ticket referenced below. The commit message solely describes '''what is changed'''. * Bullet points are okay, too * An asterisk is used for the bullet, it can be preceded by a single space. This format is rendered correctly by Forge (redmine) * Use a hanging indent Change-Id: I<some string generated by the git commit-msg hook> Resolves: #12346 Related: #12340 Releases: master, 6.2
As the commit message is kept in the history of the Git repository, please consider writing a proper message!
Topic description (first line)¶
- Prefix the line with a tag: [BUGFIX], [FEATURE], [TASK] or [CLEANUP].
- Keep the whole line below 52 characters if possible, but below 80 in any case
Possible tags are:
- [FEATURE]: A new feature (also small additions). Most likely it will be an added feature, but it could also be removed. Features may exclusively be targeted for the "master" branch of TYPO3 CMS, because no new features are allowed in older branches. Exceptions to this have to be discussed on a case-to-case basis with the designated release managers. Features have to be documented according to TYPO3 CMS Important Changes Documentation HowTo .
- [BUGFIX]: A fix for a bug.
- [CLEANUP]: This tag may be used for changes that do not alter functionality, but try to improve code style and readability. Examples: coding guideline compliance, comment improvements
- [TASK]: Anything not covered by the above categories. E.g. Refactoring of a component
Additionally other flags have to be added under certain circumstances:
- [!!!]: Breaking change. After this patch, something works different than before and the user / admin / extension developer will have to change something. Has to be documented accordingly and should only be targeted for master branch. See TYPO3 CMS Important Changes Documentation HowTo.
- [WIP]: Work In Progress. This flag will be removed, once the final version of a change is available. Changes marked WIP are never merged.
- [SECURITY]: Visualizes that a change fixes a security issue. This tag is used by the Security Team, in case you found a security issues please always follow get in contact with the Security Team first!
- Deprecations must not use the breaking Prefix [!!!]
- Deprecations may only be of type [TASK] or [FEATURE]
Example topic descriptions:¶
- [BUGFIX] Throw HttpStatusExceptions in BackendController
- [FEATURE] Add option to hide BE search box in list mod
- [!!!][FEATURE] Implement new BE login form service
- [!!!][TASK] Replace Foo API with new approach
- [SECURITY] SQL Injection vulnerability in prepared statements
Note: The [!!!] prefix is added at the very beginning of the line, so it doesn't get overlooked.
- Describe the problem and the change introduced by the Change Request. (The problem is already described in the Forge ticket.)
- Keep it simple and don't repeat information that is already part of the issue tracker. Especially avoid "How to reproduce" part. At most, try to explain the change itself, if it is not already clear by reading the diff. Do not repeat the code change itself in the body text.
- Wrap the lines after 72 characters manually
- Write your commit message in the imperative present tense ("Fix bug" and not "Fixed bug"), since a commit is a set of instructions for how to go from a previous state to the new state and the commit message should describe this process. This convention matches up with generated commit messages by commands like git merge and git revert.
Important: The space after the colon (:) is mandatory. Otherwise the system will not properly update forge.
Refer to the bug tracker entry (features and tasks, closes the issue on submit) (on https://forge.typo3.org/ ):
Historical : Some issues from the time since the introduction of GIT (March 1st 2011) and the migration of the bug tracker to Forge (March 29th 2011), still refer to Mantis bug tracker numbers, with a prefix the number with an M , i.e.:
Refer to the bug tracker entry (all types, simply a relation, no closing) (on https://forge.typo3.org ):
Refer to the branches for which this change will apply: This should be done on bugfixes which should be backported to older, still actively supported, releases.:
Releases: master, 7.6, 6.2
For TYPO3 documentation patches, refer to the corresponding TYPO3 Core patch:
If you have multiple resolved or related issues, use one line for each issue number.
This unique randomly generated ID will later identify this change in the review
system. Be sure to keep the same Change-Id (using
git commit --amend) when
adding a new patchset to an existing review.
Change-Id line is added automatically by the
git commit hook. Do not add this line manually
unless you know what you are doing. The commit hook is executed after you edited
your commit message, so just leave it out and it will be added after exiting the
If there's the need to revert a patch, please add this information to the commit message:
- a Resolves-line for the ticket with reason for the revert
- a Reverts-line for the ticket of the original patch
You can use a custom template for getting the commit message faster done.
All you need is the template like:
[BUGFIX|TASK] Resolves: Releases:
in a file, e.g. ~/.gitmessage.txt
and the command:
git config --global commit.template ~/.gitmessage.txt