使用 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 http://trac.edgewall.org/, Redmine http://www.redmine.org/等等指定额外的语法元素。例如,Redmine 用户可以包含问题编号和一些特殊关键字来将问题标记为已解决:关键字是“refs”(和“references”)和“fixes”(或“closes”) - 但我经常发现这很困难记住关键词。
那么,如果可以在提交指令的底部附加一些特定于项目的文本,那就会很方便。
有没有现有的方法可以做到这一点,或者我需要破解一种方法吗?作为一个附带问题,其他 VCS(如 Mercurial)是否有类似的行为?
我使用了 commit.template (如上所述here https://git-scm.com/book/ch8-1.html#committemplate-7kT8HRswI4)。我本来可以使用prepare-commit-msg钩子,但是提交模板可以使这项工作稍微容易一些,而且我可以将提交模板保留在项目的版本控制中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)