Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Commit to good commit messages

The whys and hows of a good commit message

  • Inicia sesión para ver los comentarios

Commit to good commit messages

  1. 1. Commit to good commit messages The whys and hows of a good commit message
  2. 2. Code is what really matters
  3. 3. Why?
  4. 4. –Mahatma Gandhi (probably someone else…) “Every code has a story.”
  5. 5. $ git log src/Namespace/ClassName.php commit e91d0ef22e6e0d09a9216f365db55e167fb6e8a8 Author: John Doe <johndoe@example.com> Date: Wed Feb 11 10:52:49 2015 -0200 Fix #35
  6. 6. $ git log src/Namespace/ClassName.php commit e91d0ef22e6e0d09a9216f365db55e167fb6e8a8 Author: John Doe <johndoe@example.com> Date: Wed Feb 11 10:52:49 2015 -0200 Fix #35 The company just moved from GitHub to GitLab
  7. 7. $ git log src/Namespace/ClassName.php commit e91d0ef22e6e0d09a9216f365db55e167fb6e8a8 Author: John Doe <johndoe@example.com> Date: Wed Feb 11 10:52:49 2015 -0200 Fix #35 The company just moved from GitHub to GitLab Does not work in the company anymore
  8. 8. VCS repository
  9. 9. More than a folder where you save files remotely
  10. 10. Tracks and provides control over changes to your code
  11. 11. Commit message
  12. 12. Tells the story of the code
  13. 13. Why a change was made
  14. 14. Why a feature was added
  15. 15. Code review
  16. 16. Create a changelog
  17. 17. Good commit message
  18. 18. commit ca8f13d1da23d1912602ce51837f6515a3142ede Author: Author Name <author@example.com> Date: Thu May 17 19:00:00 2018 +0200 Summarize changes in around 50 characters or less More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of the commit and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); various tools like `log`, `shortlog` and `rebase` can get confused if you run the two together. Explain the problem that this commit is solving. Focus on why you are making this change as opposed to how (the code explains that). Are there side effects or other unintuitive consequences of this change? Here's the place to explain them. Further paragraphs come after blank lines. - Bullet points are okay, too - Typically a hyphen or asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here Signed-off-by: Author Name <author@example.com> Reviewed-by: Reviewer Name <reviewer@example.com> Body Subject
  19. 19. Limit the subject line to 50 characters
  20. 20. Separate subject from body with a blank line
  21. 21. Wrap the body at 72 characters
  22. 22. Use the imperative mood in the subject line
  23. 23. Capitalize the subject line
  24. 24. Do not end the subject line with a period
  25. 25. Use the body to explain what and why vs. how
  26. 26. Tips
  27. 27. GitHub != Git
  28. 28. Use the command line
  29. 29. Keep your commits atomic
  30. 30. Don’t use git commit -m "Something"
  31. 31. Configure your editor for commit messages
  32. 32. Henrique Moody @henriquemoody Developer, Agilist, Open Source contributor, Brazilian, Dancer, Musician, Werkspot employee.
  33. 33. Thank you
  34. 34. References • https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html • http://who-t.blogspot.nl/2009/12/on-commit-messages.html • https://chris.beams.io/posts/git-commit/ • https://www.freshconsulting.com/atomic-commits/ • https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project • https://www.kernel.org/doc/html/v4.12/process/submitting-patches.html

×