我通常从问题代码开始编写git注释,如下所示:
#3533: Fixed VIB (Very Important Bug)
当我从命令行执行提交时,我写
git commit -a -m "#3533: Fixed VIB (Very Important Bug)"
一切都很好。当我执行合并或交互式rebase时,我使用vim。在重新定义vim后,我可以添加提交,但以#
开头的行被视为注释。
# This is a combination of 3 commits.
# The first commit's message is:
VIB resolved
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri Jun 23 11:31:12 2017 +0200
#
# interactive rebase in progress; onto 7832e4d
# Last commands done (3 commands done):
# s 536d248 Added space
# s ae41f15 Removed space
# No commands remaining.
# You are currently rebasing branch 'RM-3539' on '7832e4d'.
#
# Changes to be committed:
# modified: VIBfile.m
#
那么如何使用Vim以#
字符开始评论?
答案 0 :(得分:3)
您可以使用core.commentchar
配置设置。例如git -c core.commentchar=$ commit
允许您在提交消息中使用#
。您还可以在gitconfig中将core.commentchar
设置为auto,git将使用一个永远不会在提交消息开头的字符作为comment char。