Skip to content

Latest commit

 

History

History
90 lines (54 loc) · 3.5 KB

README.md

File metadata and controls

90 lines (54 loc) · 3.5 KB

Gnitpick

Git commit message nitpicker. Makes sure all future git commit messages are perfect!

Example:

$ gnitpick

Gnitpick inspecting git revisions range origin/master..HEAD
commit 32f0d152f2985b95c43e3cd79caa18104d32f413
Author: Otto Kekäläinen <[email protected]>
Date:   Mon Jun 29 10:54:45 2020 +0300

    update readme with description about how to install this project on a local development environment.

Inspecting commit 32f0d152f2985b95c43e3cd79caa18104d32f413:
Gnitpick commit inspection did not pass!

Fix these fails and try again:
- 32f0d152: Commit message title ends in a period character
- 32f0d152: Commit message title is over 72 characters
- 32f0d152: Commit message title does not start with an uppercase letter

Read more about about git best practices at
https://github.com/Seravo/gnitpick#recommended-reads

Why?

Even though git has been around now for 15+ years and is the de-facto solution for version control in all modern software projects, developers and contributors in software projects do not intuitively seem to grasp the best practices in building software patch-by-patch and describing the WHAT and WHY for each step.

Senior developers should not spend too much time on teaching juniors on how to make sensible git commit messages. We simply suggest you make your team read any of the excellent git commit title/message articles out there and then enforce following them by applying Gnitpick to your git repository CI pipeline.

Recommended reads

See also a basic presentation on git best practices on Slideshare:

Git best practices presentation on Slideshare

..or the extended 3 hour workshop version with 70 slides:

Git workshop presentation on Slideshare.

Installation and usage

Install Gnitpick globally with:

curl -sS https://raw.githubusercontent.com/Seravo/gnitpick/master/gnitpick.py -o /usr/bin/gnitpick
chmod +x /usr/bin/gnitpick

To launch it, simply run it you git repository directory:

$ gnitpick
Gnitpick inspecting git revisions range origin/master..HEAD
No commits in range origin/master..HEAD
Using origin/master..HEAD instead.

Gnitpick commit inspection passed!

Local git hook

See git-hooks/pre-push as an example.

Travis-CI

Simply add this to your .travis.yml file:

- curl -O https://raw.githubusercontent.com/Seravo/gnitpick/master/gnitpick.py
- python3 ./gnitpick.py

Live examples

For live examples, see the Makefile in Fevermap or the .gitlab-ci.yml in Fevermap or the .travis.yml in Seravo Plugin

Development status

Early stages... Pull requests welcome!

License

This script is published under GPLv3. Feel free to use. Contributions welcome!