I'm setting up a node project with husky
and I want to have a git-hook script run manually, without having to trigger it in git.
Example:
My package.json has the following:
{
...
"scripts": {
"precommit": // something goes here
}
...
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
...
}
If I run npm run precommit
, the lint-staged
hook step runs, WITHOUT the commit actually occurring in git.
Is this possible?
It should be possible, since this answer illustrates you can simply call the .git/hooks/pre-commit
So as long as you are calling the hook directly, with its full path, you would run whatever it contains.