git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/3] SubmittingPatches: explain why we care about log messages

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 26, 2022, 23:42 UTC
Message-ID
<20220126234205.2923388-4-gitster@pobox.com>
In-Reply-To
<20220126234205.2923388-1-gitster@pobox.com>

Extend the "describe your changes well" section to cover whom we are trying to help by doing so in the first place.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/SubmittingPatches | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 7225a0fb52..9c5977fac3 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -110,6 +110,34 @@ run `git diff --check` on your changes before you commit.
 [[describe-changes]]
 === Describe your changes well.
 
+The log message that explains your changes is as much important as the
+changes themselves.  Your code may be clearly written with in-code
+comment to sufficiently explain how it works with the surrounding
+code, but those who need to fix or enhance your code in the future
+will need to know _why_ your code does what it does, for a few reasons:
+
+. Your code may be doing something differently from what you wanted it
+  to do.  Writing down what you actually wanted to achieve will help
+  them fix your code and make it do what it should have been doing
+  (also, you often discover your own bug while writing your log
+  message yourself).
+
+. Your code may be doing things that were only necessary for your
+  immediate needs (e.g. "do X to directories" without implementing or
+  even designing what is to be done on files).  Writing down why you
+  excluded what the code does not do will help guide future developers
+  (e.g. writing down "we do X to directories, because directories have
+  characteristic Y" would help them infer "oh, files also have the
+  same characteristic Y, so perhaps doing X to them would also make
+  sense?".  Or "we don't do the same X to files, because ..." will
+  help them decide if the reasoning is sound (in which case they do
+  not waste time extending your code to cover files), or reason
+  differently (in which case they explain why they extend your code to
+  cover files, too).
+
+The goal of your log message is to convey the _why_ behind your
+change to help them.
+
 The first line of the commit message should be a short description (50
 characters is the soft limit, see DISCUSSION in linkgit:git-commit[1]),
 and should skip the full stop.  It is also conventional in most cases to
-- 
2.35.0-155-g0eb5153edc
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 28 in “[RFC] Contributor doc: more on the proposed log message”
  1. Junio C HamanoJan 23, 2022
  2. brian m. carlsonJan 23, 2022
  3. Kaartic SivaraamJan 26, 2022
  4. 0/3 contributor doc update around log messagesJunio C Hamano, Jan 26, 2022
  5. 1/3 SubmittingPatches: write problem statement in the log in the present tenseJunio C Hamano, Jan 26, 2022
  6. 2/3 CodingGuidelines: hint why we value clearly written log messagesJunio C Hamano, Jan 26, 2022
  7. Eric SunshineJan 27, 2022
  8. Junio C HamanoJan 27, 2022
  9. 3/3 SubmittingPatches: explain why we care about log messagesJunio C Hamano, Jan 26, 2022
  10. 0/3 contributor doc update around log messagesJunio C Hamano, Jan 27, 2022
  11. Emily ShafferMar 4, 2022
  12. 1/3 SubmittingPatches: write problem statement in the log in the present tenseJunio C Hamano, Jan 27, 2022
  13. Emily ShafferMar 3, 2022
  14. Junio C HamanoMar 4, 2022
  15. Emily ShafferMar 4, 2022
  16. 2/3 CodingGuidelines: hint why we value clearly written log messagesJunio C Hamano, Jan 27, 2022
  17. Emily ShafferMar 4, 2022
  18. Junio C HamanoMar 4, 2022
  19. Junio C HamanoApr 14, 2022
  20. Ævar Arnfjörð BjarmasonApr 14, 2022
  21. Emily ShafferApr 19, 2022
  22. Junio C HamanoApr 20, 2022
  23. 3/3 SubmittingPatches: explain why we care about log messagesJunio C Hamano, Jan 27, 2022
  24. Emily ShafferMar 4, 2022
  25. Junio C HamanoMar 4, 2022
  26. log messages > comments (was: [PATCH v3 3/3] SubmittingPatches: explain why we care about log messages)Ævar Arnfjörð Bjarmason, Mar 4, 2022
  27. Junio C HamanoMar 4, 2022
  28. Junio C HamanoMar 4, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.