For Git messages I use git commit -m
to add a headline to a git commit.
So far, I’ve never used the detailed summary which you can add to a commit message. It was tooMuch of a hassle to open a text editor and add a detailed explanation.
Today I learned that you can write a multi-line commit message with git commit -m
.
For example, in Bash:
git commit -m 'my headline
Here goes the detailed explanation of the commit
'
Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) 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.
The last thing to keep in mind is the commit message. Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior — this is a good guideline to follow. Write your commit message in the imperative: “Fix bug” and not “Fixed bug” or “Fixes bug.”