用哈希标记(#)开始一个git commit消息 [英] Start a git commit message with a hashmark (#)
问题描述
当提交时,Git将以#
开头的行作为注释行。这在使用票务跟踪系统时非常烦人,并且试图在票号的开头写入票号,例如
#123盐散列的密码
git将简单地从提交消息中删除该行。有什么办法可以逃避哈希?我试过 \
和!
,但没有任何效果。 #
之前的空格被保留下来,所以它们也不是解决问题的工作方法。
此行为是 git commit
的默认清理行为的一部分。如果你想保留以#
开头的行,你可以使用其他的清理模式。
p>
git commit --cleanup = whitespace
如果你这样做,你必须小心删除所有不希望出现在提交中的#
行。
Git treats lines starting with #
as comment lines when committing. this is very annoying when working with a ticket tracking system, and trying to write the ticket number at the beginning of the line, e.g.
#123 salt hashed passwords
git will simply remove the line from the commit message. is there any way to escape the hash? i tried \
and !
, but nothing works. whitespaces before #
are preserved, so they aren't a working solution to the problem either.
This behaviour is part of git commit
's default 'clean-up' behaviour. If you want to keep lines starting with #
you can use an alternative clean-up mode.
E.g.
git commit --cleanup=whitespace
If you do this you have to be careful to remove all #
lines that you don't want to appear in the commit.
这篇关于用哈希标记(#)开始一个git commit消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!