2017-07-28 112 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... 
相關問題