如何设置Git提交注释模板
在使用Git做版本控制工具的团队协作开发中,为了保证团队成员在提交代码时注释的规范性,我们通常都希望制定这样一种规范来约束他们,下面我将介绍如何在Git命令行下和TortoiseGit可视化界面下设置提交注释模板。
Git命令行下设置提交注释模板
- 创建xxx_template文件,其内容为团队制定的Git提交注释规范,如:
Desgraption:
Date:
Author:
- 通过git config命令配置commit_template,如:
git config –global commit.template /d/develop/Git/Git_Home/commit_template
- 设置git commit时填写注释所用的编辑器,如:
git config –global core.editor vi
- OK,设置完成,提交使用git commit会出现与下图相似的界面填写好注释才能提交成功:
PS:与团队成员约定做git提交时使用git commit