2010-10-01 105 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

“忽略”表示没有保存。注释行仅用于实际编写提交消息时 - 它们不会保存以供以后使用。

相关问题