在多人开发项目的时候,这时候 git commit 内容提交格式就很重要了。基于这个需求了解了下如何配置
使用配置文件
// 配置文件存放在当前项目的根目录里(全局配置,文件位置随意)
git config commit.template <filename>
git config --global commit.template <filename>
// example
git config -g commit.template gitcommit_template.txt

使用现有的工具
- 使用 vim
设置成功后,输入命令 git commit 就可以触发
git config --global core.editor "vim"
- vs code
一样的通过 git commit 触发
就遇到一个疑问,编辑界面打开了,怎么结束编辑呢。之后发现关闭当前编辑就可以了(vs code 快捷键 CTRL +W)
git config --global core.editor "code --wait"

偏方
其实还有一种结局的方式,那就是输入法啊。你设置一个自定义的长句
输入法设置里都会又
疑问
- 文件的内容如何设定
因为是txt你设置啥内容都可以,看你们项目是如何设定的
网友评论