Home > front end >  ${BRANCH_NAME} hasn't replaced in git commit template
${BRANCH_NAME} hasn't replaced in git commit template

Time:12-30

git version is 2.39.0, git template has configed.

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

.gitmessagefile content:

# 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}

but, ${BRANCH_NAME} hasn't replaced with current branch's name after i typeed git commit
commit message editing in vim

CodePudding user response:

Git does not do this for you.

If you would like to have something (not Git itself) do it for you, write yourself a "prepare commit message" hook as described in the githooks documentation. The name of this hook is prepare-commit-msg and it must be located in .git/hooks or your configured hook directory.

You must write this hook yourself (or perhaps find one, but StackOverflow is not the place to go for recommendations of this sort).

  •  Tags:  
  • git
  • Related