{"id":13630321,"url":"https://github.com/tarmolov/git-hooks-js","last_synced_at":"2025-04-05T14:09:52.907Z","repository":{"id":34117692,"uuid":"37948129","full_name":"tarmolov/git-hooks-js","owner":"tarmolov","description":"A tool to manage and run project git hooks","archived":false,"fork":false,"pushed_at":"2019-04-26T21:31:25.000Z","size":75,"stargazers_count":167,"open_issues_count":5,"forks_count":30,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T06:04:20.628Z","etag":null,"topics":["development","git","hooks","post-commit","pre-commit","pre-push"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kelektiv/node-uuid","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tarmolov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-23T22:17:33.000Z","updated_at":"2024-05-27T14:08:32.000Z","dependencies_parsed_at":"2022-08-03T19:15:11.637Z","dependency_job_id":null,"html_url":"https://github.com/tarmolov/git-hooks-js","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarmolov%2Fgit-hooks-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarmolov%2Fgit-hooks-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarmolov%2Fgit-hooks-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarmolov%2Fgit-hooks-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarmolov","download_url":"https://codeload.github.com/tarmolov/git-hooks-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345856,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["development","git","hooks","post-commit","pre-commit","pre-push"],"created_at":"2024-08-01T22:01:38.327Z","updated_at":"2025-04-05T14:09:52.890Z","avatar_url":"https://github.com/tarmolov.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# git-hooks-js\n\n[![NPM version](https://badge.fury.io/js/git-hooks.svg)](https://www.npmjs.com/package/git-hooks) [![Build Status](https://travis-ci.org/tarmolov/git-hooks-js.svg)](https://travis-ci.org/tarmolov/git-hooks-js) [![Coverage Status](https://coveralls.io/repos/tarmolov/git-hooks-js/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/tarmolov/git-hooks-js?branch=master) [![Dependency Status](https://david-dm.org/tarmolov/git-hooks-js.svg)](https://david-dm.org/tarmolov/git-hooks-js) [![npm](https://img.shields.io/npm/dm/git-hooks.svg?maxAge=2592000)](https://www.npmjs.com/package/git-hooks)\n\n`git-hooks` is an utility for managing and running project [git hooks](http://git-scm.com/docs/githooks) for [nodejs](http://nodejs.org/) projects.\n\nIt has zero dependecies and easy to use.\n\nJust [install git-hooks](#install) and it will run your hooks when a hook is called by git.\n\n## Why do you need git hooks in your project?\nHooks are little scripts you can place in `$GIT_DIR/hooks` directory to trigger action at certain points.\n\nThey are very powerful and helpful.\n\nYou can do a lot of things with them:\n\n  * [Validate code](http://jshint.com/) and run tests before commit.\n  * [Check codestyle](http://jscs.info/).\n  * Spell check the commit message or check it format.\n  * and etc.\n\n**Note.** When you use `git-hooks`, you should not modify `$GIT_DIR/hooks` directory manually because `git-hooks` will do it for you.\n\n## Supported platforms\n  * Unix\n  * macOS\n\n## Install\nInstall `git-hooks` in your project.\n```bash\nnpm install git-hooks --save-dev\n```\n\nTo keep things organized, `git-hooks` looks for scripts in sub-directories named after the git hook name.\nAll these sub-directories should be stored in `.githooks` directory in the project root.\n\nLet's create some dummy pre-commit hook.\n```bash\nmkdir -p .githooks/pre-commit\necho -e '#!/usr/bin/env node' \"\\nconsole.log('hi!');\" \u003e .githooks/pre-commit/hello.js\nchmod +x .githooks/pre-commit/hello.js\n```\n\nThen just try to commit and see how things are rolling.\n```bash\ngit add .githooks package.json\ngit commit -m \"Add git-hooks\"\n```\n\nSee also [hooks examples](examples).\n\nIt's worth to mention that our library checks for gitignore rules while executing scripts in .githooks/ directories.\n\n## Related projects\n  * Original [git-hooks](https://github.com/icefox/git-hooks) project\n  * [pre-commit](https://github.com/observing/pre-commit)\n  * [husky](https://github.com/typicode/husky)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarmolov%2Fgit-hooks-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarmolov%2Fgit-hooks-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarmolov%2Fgit-hooks-js/lists"}