When you create a new commit, git launches a text editor and writes some things to it.
Using this text editor, you intend to write a commit message that will be associated with your commit.
After you finish this, save and exit the text editor. git will use what you wrote as a commit message.
A commit message has a specific structure, described as follows:
The first line of the commit message is used as the message header (or header). The preferred commit header length is less than 40 characters, as this is the number of characters that github displays on the Commits tab of this repository before trimming it, which some people find annoying.
When compiling a heading, using a capitalized, present tense verb for the first word is common practice, although not required at all.
One new line defines the title and body of the message.
The body may consist of what you like. An overview of the changes made by your commit is reasonable. Some third-party applications use information including the body of the commit message to establish various types of intercepts (I think Gerrit and Pivotal Tracker, to name two).
Here is a short and sweet example. The lead # denotes a comment.
Gitignore index.pyc Ignore gunicorn generated binary file
Here , Mr. Torvalds alone believes he is doing a good thing.
And here Tpope does the same.
As pointed out in several other answers, changing the default editor is single-line on the command line.
According to my preference:
git config --global core.editor "vim"