是否可以修改默认git提交消息的注释部分?我想为我的用户添加更多"上下文"信息.
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# Explicit paths specified without -i nor -o; assuming --only paths...
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: test.txt
#
Run Code Online (Sandbox Code Playgroud)
Jak*_*ski 73
有commit.template配置变量,根据git-config(1)手册页:
指定要用作新提交消息模板的文件."
~/"扩展为$ HOME和"~user/" 的值到指定用户的主目录.
您可以将它放在per-repository(.git/config),user(~/.gitconfig)和system(/etc/gitconfig)配置文件中.
wei*_*ure 45
你可以使用git hooks.在提交更改的人员显示提交消息之前,将运行prepare-commit-msg脚本.
您可以在.git/hooks中找到一个示例prepare-commit-msg脚本.
要编辑默认消息,请在.git/hooks文件夹中创建名为prepare-commit-msg的新文件.您可以使用如下脚本编辑提交消息:
#!/bin/sh
echo "#Some more info...." >> $1
Run Code Online (Sandbox Code Playgroud)
$ 1变量存储提交消息文件的文件路径.
| 归档时间: |
|
| 查看次数: |
21169 次 |
| 最近记录: |