Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I know I can write any words as commit summary. My commit summaries always like : "a bug fixed", "new function achieved".... However, when my project growing, I found my previous commit summaries become to meaningless. It does no help.

My Question is:

Is there any common pattern or naming convention or format for git commit summary?


migration rejected from stackoverflow.com Mar 22 at 10:57

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as primarily opinion-based by gnat, MichaelT, Thomas Owens Mar 22 at 10:57

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

The summary should primarily summarize the commit description. And since it can't be long, there is not much space for common format. Treat it like subject if you were sending the description by email (in fact that's exactly what happens in git project itself). That said, there are few hints:

  • When fixing bug, by all means include the issue number.
  • When completing feature if you have some task identifier, include that.
  • If the identifier included goes with subject, it often makes sense to just reuse it.
  • If the project is large, mention which component is affected.
  • Describe the change in functionality, never the code (that can be seen from the diff).

And try to describe the mental process behind why you changed the code the way you did in the long description. It helps a lot when there is a bug in the code or when somebody needs to change the code later and needs to tell whether strange piece of code is a workaround, obsolete, bug or what.


Not the answer you're looking for? Browse other questions tagged or ask your own question.