Giter Club home page Giter Club logo

git-hooks's Introduction

git-hooks

  codecov   GitHub tag (latest SemVer)

What is git-hooks?

Git hooks is a commit hook that works with git to make sure your issue, ticket, Jira, and story numbers make it to the commit message.

For example:

git checkout -b feature/GH-123-example-branch
...
# stage some work
...
git commit -m "Completed work and unit tests"
...
git log -n 1 --format=oneline
afb126992c7e780939ef9b931f38c2cb0c47f91f (HEAD -> feature/GH-123-example-branch) GH-123: Completed work and unit tests

Notice that the issue number, GH-123, was copied into the commit message.

Our hook can even handle the lack of a ticket:

git checkout -b need-this-yesterday
...
git commit -m "PROD FIX"
...
git log -n 1 --format=oneline
75d23ddd3a9bd613dde8bbe447fb6a45c7af0a3b (HEAD -> need-this-yesterday) NOGH: PROD FIX

How do I install?

Visit our releases to download the most recent binary.

Setup a central git hooks directory:

  • Windows users can use: C:\Users\<you>\.githooks\
cd ~
mkdir .githooks
git config --global core.hooksPath ~/.githooks

In the zip you downloaded from releases, you will find 3 folders:

  • Linux
  • Mac
  • Windows

Copy all files from the zip directory of your respective OS to: ~/.githooks

On Linux & Mac, make the hook executable:

chmod +x ~/.githooks/commit-msg

Lastly, edit this config file to your liking:

~/.githooks/commit-msg-config.yml

If you run into issues

  • The hook is not being triggered

    • Check your core.hooksPath - this setting can be --global or by repository. Check this first.
  • The hook is having a runtime error

    • Please submit an issue with the terminal output you received here with as much detail as possible.

Development details

For Mac, you must install some dependencies via brew. Simply run os_specific_requirements.py and you'll be good to go!

git-hooks's People

Contributors

dependabot-preview[bot] avatar lcombs15 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.