# ghooks

> Simple git hooks

Latest version **2.0.4** (published 2018-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install ghooks
pnpm add ghooks
yarn add ghooks
bun add ghooks
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2018-04-29 |
| First published | 2014-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 35 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1078 |
| Author | Guilherme Tramontina |
| Maintainers | gtramontina, jhabdas |
| Keywords | git, hooks, hook |

## Links

- npm: https://www.npmjs.com/package/ghooks
- Repository: https://github.com/gtramontina/ghooks
- Issues: https://github.com/gtramontina/ghooks/issues
- npm.io page: https://npm.io/package/ghooks

## Dependencies (6)

- [findup](https://npm.io/package/findup.md) 0.1.5
- [opt-cli](https://npm.io/package/opt-cli.md) 1.5.1
- [manage-path](https://npm.io/package/manage-path.md) 2.0.0
- [path-exists](https://npm.io/package/path-exists.md) 3.0.0
- [lodash.clone](https://npm.io/package/lodash.clone.md) 4.5.0
- [spawn-command](https://npm.io/package/spawn-command.md) 0.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2018-04-29
- 2.0.3 — 2018-04-16
- 2.0.2 — 2017-11-29
- 2.0.1 — 2017-11-25
- 2.0.0 — 2016-12-20
- 1.3.2 — 2016-07-04
- 1.3.1 — 2016-07-04
- 1.3.0 — 2016-07-02
- 1.2.4 — 2016-06-16
- 1.2.3 — 2016-06-07
- 1.2.2 — 2016-06-07
- 1.2.1 — 2016-04-12
- 1.2.0 — 2016-04-05
- 1.1.1 — 2016-03-30
- 1.1.0 — 2016-03-30
- … 14 more at https://npm.io/package/ghooks/versions

## README

# ghooks

[![version](https://img.shields.io/npm/v/ghooks.svg?style=flat-square)](http://npm.im/ghooks)
[![travis build](https://img.shields.io/travis/ghooks-org/ghooks.svg?style=flat-square)](https://travis-ci.org/ghooks-org/ghooks)
[![AppVeyor](https://img.shields.io/appveyor/ci/gtramontina/ghooks.svg?style=flat-square)](https://ci.appveyor.com/project/gtramontina/ghooks)
[![codecov coverage](https://img.shields.io/codecov/c/github/ghooks-org/ghooks.svg?style=flat-square)](https://codecov.io/github/ghooks-org/ghooks)
[![Dependencies status](https://img.shields.io/david/ghooks-org/ghooks.svg?style=flat-square)](https://david-dm.org/ghooks-org/ghooks#info=dependencies)
[![Dev Dependencies status](https://img.shields.io/david/dev/ghooks-org/ghooks.svg?style=flat-square)](https://david-dm.org/ghooks-org/ghooks#info=devDependencies)

[![MIT License](https://img.shields.io/npm/l/ghooks.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![downloads](https://img.shields.io/npm/dm/ghooks.svg?style=flat-square)](http://npm-stat.com/charts.html?package=ghooks&from=2014-04-01)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)

Simple git hooks

## Installation

```
npm install ghooks --save-dev
```

_It is not advised to install `ghooks` as a production dependency, as it will install git hooks in your production environment as well. Please install it under the `devDependencies` section of your `package.json`._

_Please also note, that it is absolutely **not advised** to install `ghooks` globally. To work as expected, make it a development dependency of your project(s)._

## Setup

Add a `config.ghooks` entry in your `package.json` and simply specify which git hooks you want and their corresponding commands, like the following:

```
{
  …
  "config": {
    "ghooks": {
      "pre-commit": "gulp lint",
      "commit-msg": "validate-commit-msg",
      "pre-push": "make test",
      "post-merge": "npm install",
      "post-rewrite": "npm install",
      …
    }
  }
  …
}
```

**Note:** _The hooks' working directory is relative to the git root (where you have your `.git` directory). This means that if your package.json is in a subdirectory of your git repo, you'll need to cd into the directory before running any npm scripts. E.g.:_

```json
"pre-commit": "cd path/to/folder && npm run test"
```

## opt-in/out

One of the last things you want is to raise the barrier to contributing to your open source project. So [Andreas Windt](https://github.com/ta2edchimp) developed the [opt-cli](https://npmjs.com/package/opt-cli) package to allow you to turn your hooks into opt-in/out scripts. See this project's [`package.json`](package.json) for an example of how to do that.

## All [documented](http://git-scm.com/docs/githooks) hooks are available:

* applypatch-msg
* pre-applypatch
* post-applypatch
* pre-commit
* prepare-commit-msg
* commit-msg
* post-commit
* pre-rebase
* post-checkout
* post-merge
* pre-push
* pre-receive
* update
* post-receive
* post-update
* pre-auto-gc
* post-rewrite

## Common Issues

* [Usage with git GUI clients](https://github.com/ghooks-org/ghooks/issues/18) – Thanks to [@JamieMason](https://github.com/JamieMason)

## Credits
This module is heavily inspired by [__@nlf__](https://github.com/nlf)'s [precommit-hook](https://www.npmjs.org/package/precommit-hook)

## Contributors

Huge thanks to everyone listed [here](https://github.com/ghooks-org/ghooks/graphs/contributors)!

## License

This software is licensed under the MIT license

---
_Source: https://npm.io/package/ghooks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
