2010-10-01 104 views
0

在提交信息中有該說的規則:
「開始行以‘#’將被忽略」在git commit消息中使用「#」有什麼好處?

現在我很困惑,如果我們爲什麼使用他們在所有這些線被忽略?
運行「git log」只顯示不是以#開頭的行,忽略行不顯示。

是否有任何命令顯示以'#'開頭的行?

回答

7

那麼,當你寫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 
# Changes to be committed: 
# (use "git reset HEAD ..." to unstage) 
# 
# modified: file_a.doc 
# deleted: file_b.jpg 
# 
# Untracked files: 
# (use "git add ..." to include in what will be committed) 
# 
# directory/ 

我認爲這是整個原因#線。

+1

此外,當提交是一個壓縮或修改時,會有額外的'#'行告訴您消息的不同位來自哪裏。 – 2010-10-01 12:25:03

1

「忽略」表示沒有保存。註釋行僅用於實際編寫提交消息時 - 它們不會保存以供以後使用。

相關問題