Skip to content

Commit a62b9e3

Browse files
mariocj89ezio-melotti
authored andcommitted
Improve instructions on commit messages (python#275)
* 1. Include (GH-NNNN) in the suffix in the first line * 2. Add link to instructions on how to format the commit * 3. Information on how to format a backport commit * 4. Move GH-NNN to the body on long titles * Comments from review * Comments from Mariatta * Minor consistency tweak.
1 parent b0a9e47 commit a62b9e3

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

gitbootcamp.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ local copy of a pull request as follows::
323323
$ git pr <pr_number>
324324

325325

326+
.. _accepting-and-merging-a-pr:
327+
326328
Accepting and Merging A Pull Request
327329
------------------------------------
328330

@@ -331,7 +333,8 @@ Pull requests can be accepted and merged by a Python Core Developer.
331333
1. At the bottom of the pull request page, click the ``Squash and merge``
332334
button.
333335

334-
2. Replace the reference to GitHub PR #XXX into GH-XXX.
336+
2. Replace the reference to GitHub PR #NNNN into GH-NNNN. If the title
337+
is too long, the pull request number can be added to the body.
335338

336339
3. Adjust and clean up the commit message.
337340

@@ -381,6 +384,16 @@ Alternatively, the commit hash can also be obtained by the following git command
381384
The above commands will print out the hash of the commit containing ``"bpo-12345"``
382385
as part of the commit message.
383386

387+
When formatting the message for a backport commit: leave it as the the original
388+
one, pointing to the original pull request number as well (``GH-NNNN``).
389+
390+
Example of good backport commit message::
391+
392+
bpo-12345: Improve the spam module (GH-777)
393+
394+
* Add method A to the spam module
395+
* Update the documentation of the spam module
396+
384397

385398
Editing a Pull Request Prior to Merging
386399
---------------------------------------

pullrequest.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ and for each pull request there may be several commits. In particular:
210210

211211
Commit messages should follow the following structure::
212212

213-
bpo-42: the spam module is now more spammy.
213+
bpo-42: the spam module is now more spammy. (GH-NNNN)
214214

215215
The spam module sporadically came up short on spam. This change
216216
raises the amount of spam in the module by making it more spammy.
@@ -221,6 +221,9 @@ commit, a new paragraph(s) can be added to explain in proper depth what has
221221
happened (detail should be good enough that a core developer reading the
222222
commit message understands the justification for the change).
223223

224+
Check :ref:`the git bootcamp <accepting-and-merging-a-pr>` for further
225+
instructions on how the commit should look like when merging a pull request.
226+
224227

225228
.. _cla:
226229

0 commit comments

Comments
 (0)