我在 prepare-commit-msg 文件中添加了一些提交信息的更改,然后执行以下命令:
git config --global commit.template .git/hooks/prepare-commit-msg
此后,当我执行 git commit 命令时,会收到如下所示的消息:
40 行我的更改内容,然后是提交信息。
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# Explicit paths specified without -i nor -o; assuming --only paths...
# On branch master
# Changes to be committed:
#
# modified: test
#
问题是有没有办法将此默认消息显示在顶部?或者更好的永久删除此消息?
.git/hooks/prepare-commit-message
中运行文件。 如果您在此文件中放置普通文本,则如果git成功运行它会发生什么?至于commit.status
,将其设置为false
会使--no-status
成为默认选项,因此这是一个合理的方法。 同时,更改分支时您的配置(无论是--global
还是本地)不是git更改的内容,因此没有问题。 - torek