commit-template icon indicating copy to clipboard operation
commit-template copied to clipboard

Doesn't appear to work?

Open Jakobud opened this issue 7 years ago • 2 comments

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 avatar Jan 17 '19 23:01 Jakobud

@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

wingy3181 avatar Mar 07 '19 10:03 wingy3181

@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\"",
  },

wingy3181 avatar Mar 07 '19 11:03 wingy3181