2017-07-28 106 views
0

我在Windows上使用git,当我在命令提示符下使用commit命令,我的记事本++打开了,并要求我把提交信息如下:如何使用Notepad ++在git commit消息中将标题与正文分开?

# 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'. 

这是伟大的,但我想能够将消息标题从其正文中分离出来。当我在#的上方写入提交消息时,它会像我使用commit -m命令一样发送,即它只包含一个标题。

有人可以建议正确的方法能够使用Notepad ++在提交消息中将标题与正文分开吗?

编辑:这个问题是来自大约从标题隔离体在提交信息的其他问题不同,因为其他的问题,请问如何在命令行中做到这一点,而我问怎么​​用记事本++ 做到这一点。

+0

的可能的复制[如何犯了两个命令行 “消息” 和 “说明” 的变化? ](https://stackoverflow.com/questions/16122234/how-to-commit-a-change-with-both-message-and-description-from-the-command-li) – altern

回答

1

你只需要添加标题+体由两个换行符这样的分离:

# 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) 

,然后按“保存”在记事本++和关闭窗口。

1

对于从正文中分离标题,在一行中写入提交消息标题,然后按回车键,然后在下一行中写入提交的简要描述,它将自动从标题中分离出来,然后保存并推送 和git commit -m将标题使用记事本进行描述。

#将被视为提交并且不会出现在提交消息中。

1

主题和主体之间由主题后面的第一个空行分隔。所以你有几个选择来写一个主题和一个主体的消息。

git commit -m 'foo 

bar' 

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

或在编辑器中 ,

foo 

bar 
#comment... 
#comment... 
#comment... 
相关问题