gitconventional-commits

Including issue code in the commit message header according to Conventional Commits


I am following the Conventional Commits guidelines v1.0.0 for my project and I have a question about including the issue code in the commit message header. Let's say I have an issue with code "SPAN-500". Although the specification does not mention issue codes explicitly, I have seen online both:

  1. Issue code as scope
feat(SPAN-500): add feat X to improve Y
  1. Issue code as suffix
feat: add feat X to improve Y [#SPAN-500]

How should I properly add the issue code to the commit message header?

I want to ensure that my commit messages follow the recommended conventions and maintain consistency. Any guidance or examples would be greatly appreciated.

Thank you!


Solution

  • How should I properly add the issue code to the commit message header?

    You should not put the issue code in the header. Follow the example given on the website: Add an additional footer like Refs: #SPAN-500.

    Using the "scope" field to put the issue code is not an option because

    A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis.

    and SPAN-500 is not a section of the codebase but the code of an issue.