0

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!

Amorim
  • 15
  • 9

1 Answers1

2

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.

SebDieBln
  • 3,303
  • 1
  • 7
  • 21
  • Thank you for your answer. What about the second approach? What I want to achieve is to easily link the commits to the issues so having their codes explicit on the commit message header makes some sense to me. – Amorim Jul 19 '23 at 20:21
  • I think you are free to put in the header what you seem fit. It's just that the guidlines show an example using a footer. So there might be tools that expect such information in a footer. But if putting the information in the header has some advantage for you then you could do so and still follow the rules. Of course you are always free to break the rules. – SebDieBln Jul 20 '23 at 09:32