${分支_NAME}尚未在git提交模板中替换

s5a0g9ez  于 2023-01-01  发布在  Git
关注(0)|答案(1)|浏览(44)

git版本是2.39.0,git模板已经配置好。

deepvision@ubuntu:~/source/repos/dv-detector/dv_ui$ git version
git version 2.39.0
deepvision@ubuntu:~/source/repos/dv-detector/dv_ui$ git config --list |grep template
commit.template=.gitmessage

.gitmessage文件内容:

# Description of the changes made in this commit

## Type of change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change

## Related issues
- Fixes #ISSUE_NUMBER
- Implements #ISSUE_NUMBER

## Current branch
Branch: ${BRANCH_NAME}

但是,在i键入git commit后,${分支_NAME}尚未替换为当前分支的名称
commit message editing in vim

13z8s7eq

13z8s7eq1#

Git不会为你做这些。
如果你想让其他东西(不是Git本身)帮你做这件事,你可以按照the githooks documentation中的描述写一个“prepare commit message”钩子,这个钩子的名字是prepare-commit-msg,它必须位于.git/hooks或者你配置的钩子目录下。
您必须自己编写这个钩子(或者自己找一个钩子,但是StackOverflow不是获取这类推荐的地方)。

相关问题