Closed yxliang01 closed 7 years ago
Maybe you just don't need this module at all :)
I'll be pleased if point to obscure places.
"Just install git-hooks and it will run your hooks when a hook is called by git." Well, I meant how does this module provide addition functionalities to the raw git? Yeah, I'm just kinda interested in what this module does because I am now looking for a solution to have cross-platform post-commit hooks implemented in nodejs. So, just wondering whether this is the one that I am looking for. Thanks.
When I wrote description I was sure that it was clear. Probably I was wrong ^^
By default git
runs scripts inside $GIT_DIR/hooks
directory. You can add there manually any files and git
runs them in appropriate time.
However, if you want to share hooks with your team, you should copy your hooks from $GIT_DIR/hooks
and send them to your comrades.
But if you update any hook, you have to send a new copy to all contributors. It sucks; so, probably you put hooks to the repo in git-hooks
directory, for instance, and create a script set-git-hooks.sh
which copy hooks from repo/git-hooks
to repo/.git/hooks
.
After that everything works fine: you have a history for your hooks, your team receive updated hooks via git pull
. But the one more issue is here. After update you should update hooks by executing set-git-hooks
. Obviously, some of your teammates could forget about that :)
So where git-hooks-js
saves the day. When you install git-hooks-js
via npm install
, it will replace default git hooks in $GIT_DIR/hooks
directory to some special script. When this script is run by git
, the script will run scripts from repo/.git-hooks/<hook_name>/
(if it found them).
It means that you need to install hooks only ones and if you update a hook in repo/.git-hooks/
, it will work immediately. Therefore, if you teammates run git pull
and receive updates hooks, they shouldn't do any extra work to make them work.
I hope this explanation is clearer than in README
file. If you have another questions, feel free to ask ;)
Oh! Now I got it. Thanks. I'll be using it :D. It's great.
After reading the readme.md, I just don't get what this module is for...