自定义Git提交消息模板

问题描述 投票:5回答:2

如何制作定制的提交消息模板?

我想要类似的东西:

# Short (50 chars or fewer) summary of changes

# More detailed explanatory text
git git-commit
2个回答
4
投票

将以下内容添加到您的~/.gitconfig

[commit]
  template = ~/.git-commit-message

enter image description here

创建具有以下内容的~/.git-commit-message文件:

# Short (50 chars or fewer) summary of changes

# More detailed explanatory text

参考http://git-scm.com/docs/git-config中的commit.template


0
投票

创建自定义提交模板的价值在于,您可以在创建提交消息时使用它来提醒自己(或其他人)正确的格式和样式。

© www.soinside.com 2019 - 2024. All rights reserved.