contributor-guide: submit-changes: improve instructions on commit content
cover contributor-guide: submit-changes: improve instructions on commit content
This hopefully improves instructions on how to write a proper commit for submitting to the Yocto Project/OpenEmbedded various projects.
This was prompted by some new contributor following the instructions and coming up with something different than what we had in mind.
Then I got carried away and fixed/improved a few other things in this document.
This is opinionated from someone who's used to deal with mail-based contribution so please feel free to nitpick/do bikeshedding/suggest something else even more than usual.
---
Quentin Schulz (7):
contributor-guide: submit-changes: fix improper bold string
contributor-guide: submit-changes: clarify example with Yocto bug ID
contributor-guide: submit-changes: align CC tag description
contributor-guide: submit-changes: make the Cc tag follow kernel guidelines
contributor-guide: submit-changes: reword commit message instructions
contributor-guide: submit-changes: number instruction list in commit your changes
contributor-guide: submit-changes: make "Crediting contributors" part of "Commit your changes"
documentation/contributor-guide/submit-changes.rst | 186 +++++++++++---------- 1 file changed, 96 insertions(+), 90 deletions(-)
---
base-commit: e77139b5c616e6e5ad436eb91416fd804389425f
change-id: 20250918-submit-patches-4c2733a3d56d
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH 1/7 contributor-guide: submit-changes: fix improper bold string
From: Quentin Schulz <[email protected]>
I don't know what was the initial intent but this doesn't seem right, so let's remove the bold formatting.
--- documentation/contributor-guide/submit-changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
documentation/contributor-guide/submit-changes.rst +1 -1
@@ -123,7 +123,7 @@ to add the upgraded version. $ git commit -s file1 file2 dir1 dir2 ... - To include **a**\ ll staged files:: + To include all staged files:: $ git commit -sa
Signature · 1 line
2.51.0
PATCH 2/7 contributor-guide: submit-changes: clarify example with Yocto bug ID
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
The example could be understood as the content of the commit message once the editor (git config core.editor) opens, where the first line is the actual commit title and not the commit description.
This example would make the Fixes line the commit title, which is not what we want.
In short, according to my understanding of git-commit(1):
The following is a git commit message:
"""
git commit title
git commit description
"""
--- documentation/contributor-guide/submit-changes.rst | 2 ++ 1 file changed, 2 insertions(+)
documentation/contributor-guide/submit-changes.rst +2 -0
@@ -198,6 +198,8 @@ to add the upgraded version. description. Be sure to use the actual bug-tracking ID from Bugzilla for bug-id:: + single-line summary of change + Fixes [YOCTO #bug-id] detailed description of change
Signature · 1 line
2.51.0
PATCH 3/7 contributor-guide: submit-changes: align CC tag description
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
The other tag descriptions have the double colon outside of the highlight, and start the sentence with a lowercase word, so let's align the CC tag with those.
--- documentation/contributor-guide/submit-changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
documentation/contributor-guide/submit-changes.rst +1 -1
@@ -223,7 +223,7 @@ to add the upgraded version. or are submitting an unmodified patch again as part of a new iteration of your patch series. - - ``CC:`` Name and email of people you want to send a copy + - ``CC``: name and email of people you want to send a copy of your changes to. This field will be used by ``git send-email``. See `more guidance about using such tags
Signature · 1 line
2.51.0
PATCH 4/7 contributor-guide: submit-changes: make the Cc tag follow kernel guidelines
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
The kernel docs specifies[1] a Cc: tag and not CC: tag, so let's align with that.
--- documentation/contributor-guide/submit-changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
documentation/contributor-guide/submit-changes.rst +1 -1
@@ -223,7 +223,7 @@ to add the upgraded version. or are submitting an unmodified patch again as part of a new iteration of your patch series. - - ``CC``: name and email of people you want to send a copy + - ``Cc``: name and email of people you want to send a copy of your changes to. This field will be used by ``git send-email``. See `more guidance about using such tags
Signature · 1 line
2.51.0
PATCH 5/7 contributor-guide: submit-changes: reword commit message instructions
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This should hopefully make it clearer what is expected from the contributor.
This follows my understanding of git-commit(1)[1] where the following is a git commit message:
"""
git commit title
git commit description
"""
I'm putting the "Fixes [YOCTO" line in "body of the commit message" so it's understood as being different from the git commit description so that the note admonition allowing us to have an empty commit description doesn't apply to the "Fixes [YOCTO" line.
[1] https://www.man7.org/linux/man-pages/man1/git-commit.1.html#DISCUSSION
--- documentation/contributor-guide/submit-changes.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
documentation/contributor-guide/submit-changes.rst +9 -9
@@ -163,7 +163,7 @@ to add the upgraded version. this project or the open source license(s) involved. - Provide a single-line summary of the change and, if more - explanation is needed, provide more detail in the body of the + explanation is needed, provide more detail in the description of the commit. This summary is typically viewable in the "shortlist" of changes. Thus, providing something short and descriptive that gives the reader a summary of the change is useful when viewing a
@@ -179,23 +179,23 @@ to add the upgraded version. git log --oneline <paths> - - For the body of the commit message, provide detailed information + - For the commit description, provide detailed information that describes what you changed, why you made the change, and the approach you used. It might also be helpful if you mention how you - tested the change. Provide as much detail as you can in the body - of the commit message. + tested the change. Provide as much detail as you can in the commit + description. .. note:: If the single line summary is enough to describe a simple - change, the body of the commit message can be left empty. + change, the commit description can be left empty. - If the change addresses a specific bug or issue that is associated - with a bug-tracking ID, include a reference to that ID in your - detailed description. For example, the Yocto Project uses a + with a bug-tracking ID, include a reference to that ID in the body of the + commit message. For example, the Yocto Project uses a specific convention for bug references --- any commit that addresses - a specific bug should use the following form for the detailed - description. Be sure to use the actual bug-tracking ID from + a specific bug should use the following form for the body of the commit + message. Be sure to use the actual bug-tracking ID from Bugzilla for bug-id:: single-line summary of change
Signature · 1 line
2.51.0
PATCH 6/7 contributor-guide: submit-changes: number instruction list in commit your changes
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
... so that it's clear that you need to read and follow each and every instruction in this list.
--- documentation/contributor-guide/submit-changes.rst | 116 ++++++++++----------- 1 file changed, 58 insertions(+), 58 deletions(-)
documentation/contributor-guide/submit-changes.rst +58 -58
@@ -127,82 +127,82 @@ to add the upgraded version. $ git commit -sa - - The ``-s`` option of ``git commit`` adds a "Signed-off-by:" line - to your commit message. There is the same requirement for contributing - to the Linux kernel. Adding such a line signifies that you, the - submitter, have agreed to the `Developer's Certificate of Origin 1.1 - <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin>`__ - as follows: + #. The ``-s`` option of ``git commit`` adds a "Signed-off-by:" line + to your commit message. There is the same requirement for contributing + to the Linux kernel. Adding such a line signifies that you, the + submitter, have agreed to the `Developer's Certificate of Origin 1.1 + <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin>`__ + as follows: - .. code-block:: none + .. code-block:: none - Developer's Certificate of Origin 1.1 + Developer's Certificate of Origin 1.1 - By making a contribution to this project, I certify that: + By making a contribution to this project, I certify that: - (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or - (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or - (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. - (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. - - Provide a single-line summary of the change and, if more - explanation is needed, provide more detail in the description of the - commit. This summary is typically viewable in the "shortlist" of - changes. Thus, providing something short and descriptive that - gives the reader a summary of the change is useful when viewing a - list of many commits. You should prefix this short description - with the recipe name (if changing a recipe), or else with the - short form path to the file being changed. + #. Provide a single-line summary of the change and, if more + explanation is needed, provide more detail in the description of the + commit. This summary is typically viewable in the "shortlist" of + changes. Thus, providing something short and descriptive that + gives the reader a summary of the change is useful when viewing a + list of many commits. You should prefix this short description + with the recipe name (if changing a recipe), or else with the + short form path to the file being changed. - .. note:: + .. note:: - To find a suitable prefix for the commit summary, a good idea - is to look for prefixes used in previous commits touching the - same files or directories:: + To find a suitable prefix for the commit summary, a good idea + is to look for prefixes used in previous commits touching the + same files or directories:: - git log --oneline <paths> + git log --oneline <paths> - - For the commit description, provide detailed information - that describes what you changed, why you made the change, and the - approach you used. It might also be helpful if you mention how you - tested the change. Provide as much detail as you can in the commit - description. + #. For the commit description, provide detailed information + that describes what you changed, why you made the change, and the + approach you used. It might also be helpful if you mention how you + tested the change. Provide as much detail as you can in the commit + description. - .. note:: + .. note:: - If the single line summary is enough to describe a simple - change, the commit description can be left empty. + If the single line summary is enough to describe a simple + change, the commit description can be left empty. - - If the change addresses a specific bug or issue that is associated - with a bug-tracking ID, include a reference to that ID in the body of the - commit message. For example, the Yocto Project uses a - specific convention for bug references --- any commit that addresses - a specific bug should use the following form for the body of the commit - message. Be sure to use the actual bug-tracking ID from - Bugzilla for bug-id:: + #. If the change addresses a specific bug or issue that is associated + with a bug-tracking ID, include a reference to that ID in the body of the + commit message. For example, the Yocto Project uses a + specific convention for bug references --- any commit that addresses + a specific bug should use the following form for the body of the commit + message. Be sure to use the actual bug-tracking ID from + Bugzilla for bug-id:: - single-line summary of change + single-line summary of change - Fixes [YOCTO #bug-id] + Fixes [YOCTO #bug-id] - detailed description of change + detailed description of change #. *Crediting contributors:* By using the ``git commit --amend`` command, you can add some tags to the commit description to credit other contributors
Signature · 1 line
2.51.0
PATCH 7/7 contributor-guide: submit-changes: make "Crediting contributors" part of "Commit your changes"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to differentiate crediting contributors from committing your changes, so let's simply make it the last step of "Commit your changes" section.
This simply indents the text so it's now part of "Commit your changes" list instead of the main list in the "Implement and commit changes" section. Because of this reorganisation, the instruction to use "git commit --amend" to add the contributors is moved to a note, and the first few sentences are reworded to better match the wording of other items in the "Commit your changes" list of instructions.
--- documentation/contributor-guide/submit-changes.rst | 44 ++++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-)
documentation/contributor-guide/submit-changes.rst +24 -20
@@ -204,31 +204,35 @@ to add the upgraded version. detailed description of change -#. *Crediting contributors:* By using the ``git commit --amend`` command, - you can add some tags to the commit description to credit other contributors - to the change: + #. If other people participated in this patch, add some tags to the commit + description to credit other contributors to the change: - - ``Reported-by``: name and email of a person reporting a bug - that your commit is trying to fix. This is a good practice - to encourage people to go on reporting bugs and let them - know that their reports are taken into account. + - ``Reported-by``: name and email of a person reporting a bug + that your commit is trying to fix. This is a good practice + to encourage people to go on reporting bugs and let them + know that their reports are taken into account. - - ``Suggested-by``: name and email of a person to credit for the - idea of making the change. + - ``Suggested-by``: name and email of a person to credit for the + idea of making the change. - - ``Tested-by``, ``Reviewed-by``: name and email for people having - tested your changes or reviewed their code. These fields are - usually added by the maintainer accepting a patch, or by - yourself if you submitted your patches to early reviewers, - or are submitting an unmodified patch again as part of a - new iteration of your patch series. + - ``Tested-by``, ``Reviewed-by``: name and email for people having + tested your changes or reviewed their code. These fields are + usually added by the maintainer accepting a patch, or by + yourself if you submitted your patches to early reviewers, + or are submitting an unmodified patch again as part of a + new iteration of your patch series. - - ``Cc``: name and email of people you want to send a copy - of your changes to. This field will be used by ``git send-email``. + - ``Cc``: name and email of people you want to send a copy + of your changes to. This field will be used by ``git send-email``. - See `more guidance about using such tags - <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes>`__ - in the Linux kernel documentation. + See `more guidance about using such tags + <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes>`__ + in the Linux kernel documentation. + + .. note:: + + One can amend an existing git commit message to add missing tags for + contributors with the ``git commit --amend`` command. Test your changes -----------------
Signature · 1 line
2.51.0
Antonin Godard
AppliedQuoted 10 lines · Quentin Schulz
This hopefully improves instructions on how to write a proper commit for submitting to the Yocto Project/OpenEmbedded various projects.
This was prompted by some new contributor following the instructions and coming up with something different than what we had in mind.
Then I got carried away and fixed/improved a few other things in this document.
[...]
Applied, thanks!
[1/7] contributor-guide: submit-changes: fix improper bold string
commit: 6c499b3796a578a0fe4c319c9547b4321b0d41df
[2/7] contributor-guide: submit-changes: clarify example with Yocto bug ID
commit: a5862406bf3230befe9db9f2539bbbc86c02015d
[3/7] contributor-guide: submit-changes: align CC tag description
commit: f116e93fb335e9d0f85891c4cb501bcf55b18ccf
[4/7] contributor-guide: submit-changes: make the Cc tag follow kernel guidelines
commit: f800fef4e9e2c1d3584ac49be8324638d2923b17
[5/7] contributor-guide: submit-changes: reword commit message instructions
commit: b84903a760350bd118c56ea9ce4e98039edf6e55
[6/7] contributor-guide: submit-changes: number instruction list in commit your changes
commit: c628a489f081925fabaabb5acac6752251150269
[7/7] contributor-guide: submit-changes: make "Crediting contributors" part of "Commit your changes"
commit: eff4d14e28d323ebfdaeb0c5c805b5f1e2ad153dBest regards,
Signature · 1 line
Antonin Godard <[email protected]>