GithubHelp home page GithubHelp logo

akesson / git-good-commit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tommarshall/git-good-commit

0.0 0.0 0.0 619 KB

Git hook to help you write good commit messages, with no external dependencies.

License: MIT License

Makefile 1.66% Shell 98.34%

git-good-commit's Introduction

git-good-commit

Build Status

Git hook to help you write good commit messages.

Validates commit messages conform to six of the seven rules of a great git commit message, plus a couple of extras:

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how - you're on your own with this one
  8. Do no write single worded commits
  9. Do not start the subject line with whitespace

Offers an interactive prompt if any of the rules are detected to be broken.

git-good-commit animated demo

Installation

Single repository

At the root of the repository, run:

curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.6.1/hook.sh > .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg

Globally

To use the hook globally, you can use git-init's template directory:

mkdir -p ~/.git-template/hooks
git config --global init.templatedir '~/.git-template'
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.6.1/hook.sh > ~/.git-template/hooks/commit-msg && chmod +x ~/.git-template/hooks/commit-msg

The hook will now be present after any git init or git clone. You can safely re-run git init on any existing repositories to add the hook there.


If you're security conscious, you may be reasonably suspicious of curling executable files. In this case you're on HTTPS throughout, and not piping directly to execution, so you can check contents and the hash against MD5 12fd3b8829eead2eff9a72598cbc9f4b for v0.6.1.

Usage

echo "apple" > ./bar.txt
git add fruits.txt

# should warn you that the subject line is not capitalised, and offer an interactive prompt.
git commit -m 'add fruits.txt'

Options

e - edit commit message
y - proceed with commit
n - abort commit
? - print help

Configuration

The default colour setting is auto, but the hook will use git's color.ui config setting if defined. You override the colour setting for the hook with:

git config --global hooks.goodcommit.color "never"

Supported values are always, auto, never and false.

Dependencies

None, other than Bash.

Credits

git-good-commit's People

Contributors

laurent-malvert avatar rakeen avatar tommarshall avatar walle 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.