fernando fernando - 11 days ago 5
Git Question

How can I make git commit messages divide into multiple lines?

When I use

git log
to check out my commit explanatory note like

1. what I changed
2. blank line
3. why I changed it


in 3 lines not like
1. what i changed 2. blank line 3. why i changed
just in 1 line.

Answer

You just use the following command:

$ git commit -m "1. what i changed
> 2. blank line
> 3. why i changed"

In your terminal, just hit 'enter' for a new line. The commit message won't end until you add the closing quote. The git log will look like:

$ git log
commit abcde2f660c707br2d20411581c4183170c3p0c2
Author: Alex Pan <alexpan@stackoverflow.com>
Date:   Tue Apr 28 20:52:44 2015 -0700

    1. what i changed
    2. blank line
    3. why i changed
Comments