1、在根目录建立模板文件
如 xxx_template文件,其内容如下:
[需求/BUG]:
[模块]:
[说明]:
2、设置模板,命令如下
git config commit.template [模板文件名] //这个命令只能设置当前分支的提交模板
git config — —global commit.template [模板文件名] //这个命令能设置全局的提交模板,注意global前面是两杠
例如: git config commit.template xxx_template
git config –global commit.template xxx_template
3、设置文本编辑器,命令如下:
git config –global core.editor [编辑器名字]
例如:git config –global core.editor vi
4、编辑模板提交代码,命令如下
git commit
注意:a、git commit之前先要使用 git add 将没有入库的代码入库
b、可以使用 git commit -a 提交多个代码文件
5、在第四步之后,会以设置的编辑器打开模板文件,然后按照格式修改该文件,并保存
6、提交代码到远程分支
git push