ランキングに戻る

ghooks-org/ghooks

JavaScript

Simple git hooks

gitgit-hooksjavascriptghooks
スター成長
スター
1.1k
フォーク
63
週間成長
Issue
11
5001k
2023年2月2024年3月2025年5月2026年7月
成果物npmnpm install ghooks
README

ghooks

version travis build AppVeyor codecov coverage Dependencies status Dev Dependencies status

MIT License downloads semantic-release Commitizen friendly

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 repository, you'll need to cd into the directory before running any npm scripts. E.g.:

"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 developed the opt-cli package to allow you to turn your hooks into opt-in/out scripts. See this project's package.json for an example of how to do that.

All documented 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

Credits

This module is heavily inspired by @nlf's precommit-hook

Contributors

Huge thanks to everyone listed here!

License

This software is licensed under the MIT license

関連リポジトリ
github/gitignore

A collection of useful .gitignore templates

Creative Commons Zero v1.0 Universalgitignoregit
175k82.3k
Chalarangelo/30-seconds-of-code

Coding articles to level up your development skills

JavaScriptnpmCreative Commons Attribution 4.0 Internationalawesome-listjavascript
30secondsofcode.org
128.5k12.5k
bregman-arie/devops-exercises

Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions

PythonPyPIOtherdevopsaws
83.3k19.8k
jesseduffield/lazygit

simple terminal UI for git commands

GoGo ModulesMIT Licensecligit
80.6k2.9k
sharkdp/bat

A cat(1) clone with wings.

Rustcrates.ioApache License 2.0command-linetool
59.8k1.6k
tiimgreen/github-cheat-sheet

A list of cool features of Git and GitHub.

MIT Licenseawesomeawesome-list
git.io/sheet
58k5.4k
go-gitea/gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD

GoGo ModulesMIT Licensegiteagolang
gitea.com
57k6.9k
gogs/gogs

The painless way to host your own Git service

GoGo ModulesMIT Licensegogsgo
gogs.io
47.7k5.1k
usebruno/bruno

Opensource IDE For Exploring and Testing API's (lightweight alternative to Postman/Insomnia)

JavaScriptnpmMIT Licenseapi-clientgit
usebruno.com
45.8k2.7k
cli/cli

GitHub’s official command line tool

GoGo ModulesMIT Licensegithub-api-v4cli
cli.github.com
45.4k8.7k
files-community/Files

A modern file manager that helps users organize their files and folders.

C#MIT Licensefluent-designxaml
files.community
44.4k2.8k
logseq/logseq

A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: https://logseq.io/p/NX4mc_ggEV

ClojureGNU Affero General Public License v3.0knowledge-basegraph
logseq.com
44k2.7k