234 likes
路
6.6K reads
26 comments
Great and insightful overview... straight to the point! Thanks for sharing
Thank you, Rafael! Glad you liked it :)
Loved these tips. I have been following the "imperative mood" styling ever since I read it in the contribution guide of a public repository. I usually use the vscode git extension for my commits, so can I separate the title from the body by adding a line break?
Hey Prafful, how are you? By VS Code extension do you mean the native source control tab? If so, I've learned recently that you can use enter to normally add multiple lines to the commit message before using ctrl+enter to submit. The first line would be considered the title and every line after would correspond to the description. In fact, Git per se doesn't differentiate title and description, these meanings are given by users/conventions.
Understood. Thanks Rafael B. Pires! I thought commits also have titles and bodies similar to pull requests 馃
Hi. Yes, indeed Git does have a subject line ("title") as well as a body ("description"). I don't use VSCode so I don't know about that but when you use Git in the CLI you separate subject line and body with a newline. This is most likely what you need to do in VSCode as well :)
Simon, what I meant by Git doesn't differentiate title and description is that it's not required by default, but by good practices (which can include, also, the footer).
Here's what the docs say: "Though not required, it鈥檚 a good idea to begin the commit message with a single short (less than 50 characters) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git." (git-scm.com/docs/git-commit#_discussion)
It's said that this soft rule was established from the analysis of the commits in the kernel codebase.
In fact, you can (and should) concatenate paragraphs, but you can also type just one very long commit message with all the descriptions, which is not recommended at all and would make the git log unreadable 馃槄
So, initially, the title and description are nothing more than just the first line, and the rest of the lines in the commit message, usually separated by a blank line, by convention. But, as you said, there's a subject line indeed 馃槍
I thought this could make it clearer for Prafful to visualize the usage in VS Code, but it made it more difficult instead. My bad, sorry!
Informative, thanks for sharing.
Thanks, Chijioke!
Useful and well-written, Thank you
:) Thank you, Antonin.
I always struggle to write meaningful commits, thanks for this!
Hi Travis! I struggle too at times. This usually means I'm committing too much at once, and I split up the commit into two or more. Hope this was useful :)
Very Insightful...!!
Awesome article. Thanks a lot for sharing.
Thanks a lot, Saanvi! :)
Great content! Thanks for sharing 馃ぉ
Appreciate it, Ammaar! :)
Great
What stood out for me was when you said my commit messages should explain why and not what, a really good mindset shift, thanks a lot!
Glad you like it, Yahaya! :)
Thanks for Sharing
Short, straight to the point and excellent.
I love your work here man馃憦馃憦馃憦馃憦.
Thanks so much! I appreciate your kind words :)
Awesome
Hey could you write some more examples of 'imperative mood'? I kinda get the idea, but do not really get how to write a good one.