【发布时间】:2010-07-07 13:44:07
【问题描述】:
使用 Git,如果您正在提交,它会在提交消息下包含一个被注释掉的部分。这包含有关编写提交消息的说明以及正在更改的文件列表。像这样:
# 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 <file>..." to unstage)
#
# modified: important-file.txt
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: some-other-thing.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# untracked.txt
是否可以在此文件中添加更多材料?对于那些使用Trac、Redmine 等问题跟踪软件的人来说,一个明显的用例是指定额外的句法元素。例如,Redmine 用户可以包含问题编号和一些特殊关键字来将问题标记为已解决:关键字是“refs”(和“references”)和“fixes”(或“closes”)——但我经常觉得很难记住关键字。
如果可以在提交说明的底部附加一些特定于项目的文本,那将很方便。
是否有任何现有的方法可以做到这一点,或者我需要破解一个吗?作为一个附带问题,是否有任何其他 VCS(如 Mercurial)有类似的行为?
【问题讨论】:
-
请注意,即使您这样做,也不是所有用户都会看到它。例如,我经常从 SourceTree 提交,它不会打开编辑器,因此从不显示提交消息模板。
标签: git version-control