我想创建一个git别名,它将使用我定义的模板创建一个提交消息。
“[$firstVariable]$secondVariable:$thirdVariable”
-
分支机构编号
,
-
提交类型
-
最后一个论点是
提交消息的主题
示例:
“[1000]专长:添加新的销售控制器”
这是我的bash函数
.gitconfig
文件:
[alias]
c = "!f() { branchNumber=${1}; type=${2}; shift; shift; subject=${*}; git commit -m '['"$branchNumber"'] '"$type"': '"$subject"' '; }; f"
如果我执行这个命令,我会得到:
命令:
$ git c 1000 feat add new sales controller
返回:
错误:pathspec'sales'与git已知的任何文件都不匹配。
观察:
新销售总监
错误:pathspec'controller'与git已知的任何文件都不匹配。