Skip to content

Commit 3dd4d41

Browse files
authored
Merge pull request #18657 from Jafaral/commit-msg-format
doc: add commit message guidelines to the dev guide
2 parents 5398e01 + 5d49e40 commit 3dd4d41

File tree

1 file changed

+60
-5
lines changed

1 file changed

+60
-5
lines changed

doc/developer/workflow.rst

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,70 @@ This helps to automatically generate human-readable changelog messages.
354354
Commit Guidelines
355355
-----------------
356356

357-
There is a built-in commit linter. Basic rules:
357+
Commit messages must have a title and optionally a detailed description.
358358

359-
- Commit messages must be prefixed with the name of the changed subsystem, followed
359+
The commit title is a short summary of the commit. The following rules apply:
360+
361+
- Must be no more than 72 characters.
362+
- Must be prefixed with the name of the changed subsystem, followed
360363
by a colon and a space and start with an imperative verb.
364+
`Check <https://github.com/FRRouting/frr/tree/master/.github/commitlint.config.js>`_ all
365+
the supported subsystems.
366+
- Should not end with a period.
367+
- Should be a complete sentence.
368+
- Should "make sense" when used with release changelog.
369+
- Think of the end-users reading it and write the title to them.
370+
- FRR maintainers should not need to rewrite the message to explain
371+
your work to end-users on your behalf.
372+
373+
Example good commit titles:
374+
375+
.. code-block:: console
376+
377+
lib,bgpd: clean up clang warnings
378+
379+
babeld: convert all code to use our code formatting rules
380+
381+
doc: add commit message guidelines to the dev guide`
382+
383+
384+
The commit description should have more detailed explanation covering also the purpose
385+
of the work being done. Formatting guidelines include:
386+
387+
- Must be separated from the title by a blank line.
388+
- Must be wrapped to 72 characters, unless it is a sample output.
389+
- Markdown syntax/output code blocks (3 ticks "```" line before and after).
390+
- Write your commit message in the imperative: "Fix bug" and not "Fixed
391+
bug" or "Fixes bug." This convention matches up with commit messages
392+
generated by commands like git merge and git revert
393+
- Bullet points are okay, too.
394+
- Typically a hyphen or asterisk is used for the bullet, followed by a
395+
single space. Use a hanging indent.
396+
397+
Example good commit message:
398+
399+
.. code-block:: console
400+
401+
pim6d: support embedded-rp
402+
403+
Implement embedded RP support and configuration commands.
404+
Embedded RP is disabled by default and can be globally enabled with the
405+
command `embedded-rp` in the PIMv6 configuration node.
406+
407+
It supports the following options:
408+
- Embedded RP maximum limit
409+
- Embedded RP group filtering
361410
362-
`Check <https://github.com/FRRouting/frr/tree/master/.github/commitlint.config.js>`_ all
363-
the supported subsystems.
411+
When opening a PR, please follow the same commit message guidelines above. Also
412+
make sure:
364413
365-
- Commit messages must not end with a period ``.``
414+
- If the PR has a single commit, just copy the commit message as-is to the PR,
415+
which is the default behavior for a single commit PR on github.
416+
- If the PR has more than one commit, add a summary title for the whole PR
417+
along with a summary description encompassing all commits.
418+
- Make sure that the description you add to the PR is already captured in commits messages.
419+
In other words don't leave the commit messages empty. The PR description should just restate
420+
or summaries what the the commit messages already have.
366421
367422
Why was my pull request closed?
368423
-------------------------------

0 commit comments

Comments
 (0)