0

I am using git on windows and when I use the commit command in the command prompt, my Notepad++ opens up and asks me to put in a commit message as follows:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.

This is great, but I want to be able to separate the message title from its body. When I write my commit message above the #'s, it is sent as if I used the commit -m command, that is, it contains only a title.

Can someone suggest the proper way to be able to separate the title from the body in a commit message using Notepad++?

Edit: this question is different from other questions about separating body from title in commit messages, because the other questions ask how to do it from the command line, whereas I ask how to do it with Notepad++ .

splinter
  • 3,727
  • 8
  • 37
  • 82
  • Possible duplicate of [How to commit a change with both "message" and "description" from the command line?](https://stackoverflow.com/questions/16122234/how-to-commit-a-change-with-both-message-and-description-from-the-command-li) – altern Jul 28 '17 at 15:03

3 Answers3

6

The subject and the body are separated by the first blank line after the subject. So you have several options to write a message that has a subject and a body.

git commit -m 'foo

bar'

or

git commit -m 'foo' -m 'bar'

or in the editor,

foo

bar
#comment...
#comment...
#comment...
ElpieKay
  • 27,194
  • 6
  • 32
  • 53
3

You just need to add your title+body separated by two line breaks like this:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
Title of the commit message

Body of the commit message (description)

And press 'save' in notepad++ and close the window.

altern
  • 5,829
  • 5
  • 44
  • 72
1

For separating title from body write your commit message title in one line then, press enter and then write a brief description of the commit in the next line it will automatically be separated from the title then save and push and git commit -m will be title use notepad for descriptions.

# will be treated as commit and will not appear in the commit message.

phd
  • 82,685
  • 13
  • 120
  • 165
rohit negi
  • 56
  • 1
  • 6