All Projects → toplenboren → Simple Git Hooks

toplenboren / Simple Git Hooks

Licence: mit
A simple git hooks manager for small projects

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Simple Git Hooks

rusty-hook
git hook manager, geared toward Rust projects
Stars: ✭ 93 (-48.04%)
Mutual labels:  hook, git-hooks
Headwolf
Scaffolding for agile development based on Xposed and Sekiro/基于Xposed和Sekiro搭建的敏捷开发的脚手架🎁献给懒汉们的小礼物😘只需四步!部署完一个Hook项目!👋👋新版本只需两步!!!
Stars: ✭ 182 (+1.68%)
Mutual labels:  hook
Logrus Logstash Hook
ℹ️ Logstash hook for logrus
Stars: ✭ 150 (-16.2%)
Mutual labels:  hook
Virtualapp
VirtualApp With Compatibility Of Android 10/11/12
Stars: ✭ 163 (-8.94%)
Mutual labels:  hook
Wechatpc
PC微信hook源码,PC微信注入,逆向编程,可以制作微信机器人玩玩,仅供学习,请不要用于商业、违法途径,本人不对此源码造成的违法负责!
Stars: ✭ 154 (-13.97%)
Mutual labels:  hook
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-3.35%)
Mutual labels:  hook
React Universal Hooks
🎉 React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!
Stars: ✭ 148 (-17.32%)
Mutual labels:  hook
Ocmethodtrace
Trace Any Objective-C Method Calls
Stars: ✭ 194 (+8.38%)
Mutual labels:  hook
Dobby
a lightweight, multi-platform, multi-architecture hook framework.
Stars: ✭ 2,550 (+1324.58%)
Mutual labels:  hook
React Use Wizard
🧙 A React wizard (stepper) builder without the hassle, powered by hooks.
Stars: ✭ 162 (-9.5%)
Mutual labels:  hook
Easyrouter
A simple android framework used to route activity or action with url.
Stars: ✭ 164 (-8.38%)
Mutual labels:  hook
React Intersection Observer
React implementation of the Intersection Observer API to tell you when an element enters or leaves the viewport.
Stars: ✭ 2,689 (+1402.23%)
Mutual labels:  hook
Useworker
⚛️ useWorker() - A React Hook for Blocking-Free Background Tasks
Stars: ✭ 2,233 (+1147.49%)
Mutual labels:  hook
Reshade
A generic post-processing injector for games and video software.
Stars: ✭ 2,285 (+1176.54%)
Mutual labels:  hook
Ios Monitor Platform
📚 iOS 性能监控 SDK —— Wedjat(华狄特)开发过程的调研和整理
Stars: ✭ 2,316 (+1193.85%)
Mutual labels:  hook
Pyhooked
Pure Python hotkey hook, with thanks to pyHook and pyhk
Stars: ✭ 150 (-16.2%)
Mutual labels:  hook
Pinst
🍺 dev only postinstall hooks (package.json)
Stars: ✭ 162 (-9.5%)
Mutual labels:  hook
Pine
Dynamic java method hook framework on ART.
Stars: ✭ 171 (-4.47%)
Mutual labels:  hook
Bigbang
Stars: ✭ 194 (+8.38%)
Mutual labels:  hook
Fre
👻 Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+1684.92%)
Mutual labels:  hook

simple-git-hooks

Tests

A tool that lets you easily manage git hooks

The package was recently renamed from simple-pre-commit. See Releases for the simple-pre-commit documentation.

  • Zero dependency

  • Easy to configure (one line in package.json)

  • Lightweight*:

    Package Unpacked size
    husky v4 4.3.8 53.5 kB
    husky v5 5.0.9 24.5 kB
    pre-commit 1.2.2 ~80 kB
    simple-git-hooks 2.0.3 ~10 kB

Who uses simple-git-hooks?

What is a git hook?

A git hook is a command or script that is going to be run every time you perform a git action, like git commit or git push.

If the execution of a git hook fails, then the git action aborts.

For example, if you want to run linter on every commit to ensure code quality in your project, then you can create a pre-commit hook that would call npx lint staged.

Check out lint-staged. It works really well with simple-git-hooks.

You can look up about git hooks on the Pro Git book.

When to use it

simple-git-hooks works well for small-sized projects when you need quickly set up hooks and forget about it.

However, this package requires you to manually apply the changes to git hooks. If you update them often, this is probably not the best choice.

Also, this package allows you to set only one command per git hook.

If you need multiple verbose commands per git hook, flexible configuration or automatic update of git hooks, please check out the other packages:

Usage

Add simple-git-hooks to the project

  1. Install simple-git-hooks as a dev dependency:

    npm install simple-git-hooks --save-dev
    
  2. Add simple-git-hooks to your package.json. Fill it with git hooks and the corresponding commands.

    For example:

      "simple-git-hooks": {
        "pre-commit": "npx lint-staged",
        "pre-push": "cd ../../ && npm run format"
      }
    

    This configuration is going to run all linters on every commit and formatter on push.

    There are more ways to configure the package. Check out Additional configuration options.

  3. Run the CLI script to update the git hooks with the commands from the config:

    npx simple-git-hooks
    

Now all the git hooks are created.

Update git hooks command

  1. Change the configuration.

  2. Run npx simple-git-hooks from the root of your project.

Note for yarn2 users: Please run yarn dlx simple-git-hooks instead of the command above. More info on dlx

Note that you should manually run npx simple-git-hooks every time you change a command.

Additional configuration options

You can also add a .simple-git-hooks.json or simple-git-hooks.json file to the project and write the configuration inside it.

That way, .simple-git-hooks.json or simple-git-hooks.json should look like the following and package.json may not contain the simple-git-hooks configuration.

{
    "pre-commit": "npx lint staged",
    "pre-push": "cd ../../ && npm run format"
}

Uninstall simple-git-hooks

Uninstallation will remove all the existing git hooks.

npm uninstall simple-git-hooks
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].