pre-merge
v1.0.0
Published
githooks management forked from husky
Downloads
2
Maintainers
Readme
pre-merge-commit
Git hooks made easy
This is a fork of husky with a few changes:
Prioritizes
package.json
located next to.git
directory, instead of hard-coded upward search. This avoids the problem when a root package in a lerna monorepo and a sub package both depends on husky, it gets confused and double-updates the root git hooks with wrong paths.Changed where hooks are read from in
package.json
:{ "gitHooks": { "pre-merge-commit": "node script.js" } }
newly increased
script.js
:const GIT_REFLOG_ACTION = process.env.GIT_REFLOG_ACTION const targetBranch = GIT_REFLOG_ACTION.split(" ")[1]; const stopMergeBranch = ["test", "pre"]; if (stopMergeBranch.includes(targetBranch)) { console.error(' 大哥你不能反向合并操作,赶快撤回合并吧!!'); process.exit(1); }