10

I have been doing a oneline commit message for some time now but it doesn't give the entire information on the commit.

git commit -m "message"

I once used git Gui tool and it had option to do multiline commit message. One in header and one in detail. How do we do it from the command line?

And can some one explain any good practice to commit bug fix and new changes? I normally write "NEW:" or "FIX" at start of the commit message, i would like to know how you guys do this?

2

2 Answers 2

12

You can do from the command line:

git commit -m 'First line
Second line
Third line'

Alternatively, you can just let git trigger your editor by doing

git commit
Sign up to request clarification or add additional context in comments.

2 Comments

Multiple lines get stuffed as one in Sublime Text Editor
use git config --global core.editor "subl -n -w" to write multiline message in sublime
6

Try this:

git commit -m 'Multi
line
message'

2 Comments

In a command line, pressing enter ends the message. I think he wants to know how to actually put in a new line.
@KelvinShadewing Specifically in Windows Command Prompt, that's true. This answer works in Bash, though. Bash assumes you haven't ended the command if you're in the middle of defining a string (i.e. you haven't closed the quotes). It also works in PowerShell, apparently.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.