{"id":25492530,"url":"https://github.com/slavcodev/git-hooks","last_synced_at":"2026-02-25T22:32:45.329Z","repository":{"id":62956278,"uuid":"169151966","full_name":"slavcodev/git-hooks","owner":"slavcodev","description":"The simplest way to manage project, user, and global Git hooks","archived":false,"fork":false,"pushed_at":"2024-08-29T00:03:25.000Z","size":15,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-11T01:09:05.058Z","etag":null,"topics":["git","git-hooks"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slavcodev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-04T21:23:14.000Z","updated_at":"2022-11-09T19:28:13.000Z","dependencies_parsed_at":"2025-04-10T00:27:42.965Z","dependency_job_id":null,"html_url":"https://github.com/slavcodev/git-hooks","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/slavcodev/git-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavcodev%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavcodev%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavcodev%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavcodev%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavcodev","download_url":"https://codeload.github.com/slavcodev/git-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavcodev%2Fgit-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29843443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","git-hooks"],"created_at":"2025-02-18T22:30:47.030Z","updated_at":"2026-02-25T22:32:45.315Z","avatar_url":"https://github.com/slavcodev.png","language":"Shell","readme":"# Git Hooks\n\n[![Software License][ico-license]][link-license]\n\nThe simplest way to manage project, user, and global **[Git hooks](https://git-scm.com/docs/githooks)**.\n\n## Install\n\nJust download the `git-hooks` executable found in the directory `src` of this repository to a directory of your choice\nand ensure that it is added to your PATH environment variable so `git-hooks` can be run.\n\n~~~bash\ncurl -o /usr/local/bin/git-hooks https://raw.githubusercontent.com/slavcodev/git-hooks/master/src/git-hooks\nchmod +x /usr/local/bin/git-hooks\n~~~\n\nRun `git-hooks install` in a git project to tell it to use `git-hooks`\nand `git-hooks uninstall` at any time to revert to your previous state.\n_(Check options of these commands to specify installation)._\n\n## TL;DR\n\nGit hooks are powerful and useful. They help to automate the developers routine,\nsuch as testing, code linting, etc, but Git is limited to only one script per event.\n\nThere is where `git-hooks` comes into play.\n\nThe `git-hooks` utilizes the Git configs only. On installation, it configures `core.hooksPath`\nto tell Git to run `git-hooks trigger \u003chook-name\u003e` command.\n\nOn trigger the hooks, `git-hooks` looks in git configs for list of hooks needed to execute.\n\nFor example for `pre-commit` hooks look like:\n~~~gitconfig\n[hooks \"pre-commit\"]\n  # Using path to directory, `git-hooks` will execute scripts which name ends to hook name,\n  # or all executable files in sub-directory with name `\u003chook-name\u003e.d`.\n  all-in-dir=\"~/global-hooks\"\n\n  # You also can use pattern to run many scripts in directory.\n  all-in-dir=\"~/global-hooks/pre-commit.d/*\"\n  files-by-extension=\"~/global-hooks/mixed/*.pre-commit\"\n\n  # Or you can specify the concrete script file.\n  concrete-file=\"~/spell-checker/spell-checker.sh\"\n\n  # Unknown or not-executable files are ignored.\n  invalid-file=\"~/foo.txt\"\n\n  # Relative path is working as well (see note below).\n  relative-dir=\"project-hooks\"\n~~~\n\n_A relative path is taken as relative to the directory where the hooks are run\n([see more in documentation](https://git-scm.com/docs/githooks#_description))._\n\nThe two special sections in configs are used by `git-hooks` to look for common hooks for all events:\n~~~gitconfig\n[hooks \"pre-trigger\"]\n  # Trigger these hooks before specific hooks. \n  foo=\"~/global-hooks\"\n  \n[hooks \"post-trigger\"]\n  # Trigger these hooks after specific hooks. \n  foo=\"~/global-hooks\"\n~~~\n\nKeep in mind, The config `core.hooksPath` overrides the Git config and it would not execute \nscripts from `.git/hooks` directory inside your project. If you have hooks in that directory,\nyou have to add it config, i.e.\n~~~gitconfig\n[hooks \"post-trigger\"]\n  default=\".git/hooks\"\n~~~\n\n## Locations\n\nThe `git-hooks` respects the config location supported by `git-config`\n([see more in documentation](https://git-scm.com/docs/git-config)).\n\nExample how ot install `git-hooks` globally:\n~~~bash\ngit-hooks install --global\n~~~\n\n## Documentation\n\nFor more details see `git-hooks` help:\n~~~bash\ngit-hooks --help\n~~~\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for more details.\n\n## Credits\n\nThanks to [Benjamin Meyer](https://benjamin-meyer.blogspot.com/2010/06/managing-project-user-and-global-git.html)\nfor inspiration.\n\n**Enjoy coding ❤️**\n\n[ico-license]: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg?style=for-the-badge\n[link-license]: LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavcodev%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslavcodev%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavcodev%2Fgit-hooks/lists"}