https://github.com/unthreaded/git-hooks
Small, lightweight tool to ensure ticket numbers make it into your Git commit messages
https://github.com/unthreaded/git-hooks
git git-hooks hacktoberfest jira
Last synced: 4 months ago
JSON representation
Small, lightweight tool to ensure ticket numbers make it into your Git commit messages
- Host: GitHub
- URL: https://github.com/unthreaded/git-hooks
- Owner: unthreaded
- License: mit
- Created: 2019-08-06T21:22:57.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2026-02-08T17:06:01.000Z (5 months ago)
- Last Synced: 2026-02-08T23:43:41.406Z (5 months ago)
- Topics: git, git-hooks, hacktoberfest, jira
- Language: Python
- Homepage:
- Size: 397 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# git-hooks
[](https://github.com/unthreaded/git-hooks/actions?workflow=Git+hooks+Pipeline)
[](https://codecov.io/gh/unthreaded/git-hooks)

## 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:
```shell script
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:
```shell script
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](https://github.com/unthreaded/git-hooks/releases) to download the most recent binary.
Setup a central git hooks directory:
* Windows users can use: `C:\Users\\.githooks\ `
```shell script
cd ~
mkdir .githooks
git config --global core.hooksPath ~/.githooks
```
In the zip you downloaded from [releases](https://github.com/unthreaded/git-hooks/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:
```shell script
chmod +x ~/.githooks/commit-msg
```
On Mac you may run into a security warning. To resolve this:
```shell
xattr -rd com.apple.quarantine commit-msg
```
Lastly, edit this config file to your liking:
~/.githooks/commit-msg-config.ini
## If you run into issues
* #### The hook is not being triggered
* Check your [core.hooksPath](https://git-scm.com/docs/githooks) - 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](https://github.com/unthreaded/git-hooks/issues) with as much detail as possible.
## Contributing
[How to contribute](./CONTRIBUTING.md)