git commit template 模板设定
1、在根目录建立模板文件
如 xxx_template文件,其内容如下:
OverView:
BUG:
Description:
实例:根目录创建文件 .gitcommit_template_aicamera
[部门]
XX科技-系统研发组
[项目]
XX科技-系统研发组-AICamera
[BugId]
[问题原因]
[解决方法]
[适用机型]
2、设置模板,命令如下
git config commit.template [模板文件名] //这个命令只能设置当前分支的提交模板
git config --global commit.template [模板文件名] //这个命令能设置全局的提交模板,注意global前面是两杠
例如: git config commit.template ~/.gitcommit_template_aicamera
git config --global commit.template xxx_template
3、设置文本编辑器,提交用户名和邮件:
git config --global core.editor [编辑器名字]
例如:
git config --global core.editor vi
git config --global user.email "wuyanzu@company.com"
git config --global user.name "wuyanzu"
4、编辑模板提交代码,命令如下
git commit
注意:a、git commit之前先要使用 git add 将没有入库的代码入库
b、可以使用 git commit -a 提交多个代码文件
5、在第四步之后,会以设置的编辑器打开模板文件,然后按照格式修改该文件,并保存
6、提交代码到远程分支
git push