zlacker

[return to "Hk, a new Git hook manager"]
1. righth+K3[view] [source] 2025-02-17 16:43:57
>>DrBenC+(OP)
Git hooks are like make files for me. Copy/paste that `git staged files` command and then add your linter commands (in .githooks/pre-commit file). Add `set -e`. Set package manager post-install hook to config git to the `.githooks` dir.

Sadly I think git hook managers remove the simplicity of the whole design. Understandably since no one reads manuals anymore and projects don’t mind tacking on yet another module/plugin, however easy.

◧◩
2. warp+Hf[view] [source] 2025-02-17 17:49:22
>>righth+K3
100%, I was using husky because we were using it at work. But it turns out for my use-case all I needed was this in my package.json:

    "scripts": {
        "postinstall": "git config --local core.hooksPath etc/hooks"
    },
◧◩◪
3. rav+PQ[view] [source] 2025-02-17 22:14:28
>>warp+Hf
Ooh, core.hooksPath is quite nifty. I usually use something like

         ln -sf ../../scripts/git-pre-commit-hook .git/hooks/pre-commit
which simply adds a pre-commit symlink to a script in the repo's scripts/ dir. But hooksPath seems better.
[go to top]