Skip to content

Custom hook folder #839

@cgaube

Description

@cgaube

⚡ Summary

Right now lefthook automatically installs github hooks files in the git rev-parse --git-path hooks folder
This folder should be configurable.

Value

Every systems is configured differently,
A common scenario is to setup a global hook folder that contains all the github hooks that will delegate to other scripts stored in different directories.
A use case would be to have script executed on all your repositories installed on your computer but also add custom hooks at each repos level

e.g
~/.gitconfig

[core]
	hooksPath = ~/hooks

~/.hooks/pre-commit hooks that execute global scripts + delegate to individual repo pre-commit hooks if needed

~/repo1/.hooks/pre-commit
~/repo2/.hooks/pre-commit

Behavior and configuration changes

Add a new configuration at the root level

hooks_folder: '.hooks/'

use that directory when installing and synchronizing hooks scripts

e.g if you are in
~/repo1. lefthook install will add git hooks scripts to ~/repo1/.hooks

If hooks_folder is not provided fallback to git rev-parse --git-path hooks

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA new lefthook feature description

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions