Doesn't appear to work?
Maybe I'm misunderstanding something. This doesn't appear to work at all from what I can tell.
I installed it. I added the npm script:
"preparecommitmsg": "commit-template"
I added a file .commit-msg with some random text in it. When I run git commit I see only the default git commit message.
When I run npm run preparecommitmsg I see the commit template message just fine.
@Jakobud it's because husky has changed.
Look at the husky documentation and use below instead in your package.json (alternatively you can use a .huskyrc file now:
{
...
"husky": {
"hooks": {
"prepare-commit-msg": "commit-template"
}
}
}
However, there is a bug in this now as the environment variable has also changed... raised a PR .. seems to work with those changes for me
@Jakobud
An alternate way i thought of without an npm package is adding below to your package.json
"scripts": {
"preinstall": "git config --local commit.template \".commit-msg\"",
},