PHPackages                             purplebooth/git-github-lint - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. purplebooth/git-github-lint

ArchivedProject[Utility &amp; Helpers](/categories/utility)

purplebooth/git-github-lint
===========================

Lint github commits and update their status

v1.0.0(9y ago)031[4 PRs](https://github.com/PurpleBooth/git-github-lint/pulls)MITPHPPHP ^7.0.0

Since Aug 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/PurpleBooth/git-github-lint)[ Packagist](https://packagist.org/packages/purplebooth/git-github-lint)[ RSS](/packages/purplebooth-git-github-lint/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (6)Versions (7)Used By (0)

Git GitHub Lint
===============

[](#git-github-lint)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/60c763f231acab7b01383d4609e751cd08725deefff9c7aa5e48a16af08c7a62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f507572706c65426f6f74682f6769742d6769746875622d6c696e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PurpleBooth/git-github-lint/?branch=master)[![Build Status](https://camo.githubusercontent.com/3e0a85929252101bdac9bd6648249de18750061c0675aaa34051096f8629ad2b/68747470733a2f2f7472617669732d63692e6f72672f507572706c65426f6f74682f6769742d6769746875622d6c696e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PurpleBooth/git-github-lint)[![Dependency Status](https://camo.githubusercontent.com/bb66c6623c8dda7c7aed804fb5a70df962aac72f2d66f3e1f906fd076919a7a5/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537396166636636333831356338303035313631353334642f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/579afcf63815c8005161534d)[![Latest Stable Version](https://camo.githubusercontent.com/dc0c57fdeb7f78f5106e7566126df3926373c8bcc63be54ee4dccc4f2030686a/68747470733a2f2f706f7365722e707567782e6f72672f707572706c65626f6f74682f6769742d6769746875622d6c696e742f762f737461626c65)](https://packagist.org/packages/purplebooth/git-github-lint)[![License](https://camo.githubusercontent.com/436dbc76beb0f94c6aa23dee14a64606ec65dcc4596dbe4df57152e8d80b2584/68747470733a2f2f706f7365722e707567782e6f72672f707572706c65626f6f74682f6769742d6769746875622d6c696e742f6c6963656e7365)](https://packagist.org/packages/purplebooth/git-github-lint)

This project is designed to ensure that the commits you're making to a repository follow the git coding style. This is the library component with no web frontend.

The standard that they test for is [the one described by Chris Beams](http://chris.beams.io/posts/git-commit/).

The validations it implements are:

- Separate subject from body with a blank line
- Limit the subject line to 50 characters (soft limit, hard limit at 69)
- Capitalize the subject line
- Do not end the subject line with a period
- Wrap the body at 72 characters

Getting Started
---------------

[](#getting-started)

### Prerequisities

[](#prerequisities)

You'll need to install:

- PHP (Minimum 7.0)

### Installing

[](#installing)

```
composer require PurpleBooth/git-github-lint
```

Usage
-----

[](#usage)

### Tool

[](#tool)

You can try out this library by using it as a tool. You'll need to generate a token on the [GitHub Personal Access Token Page](https://github.com/settings/tokens/new?scopes=repo).

#### Usage

[](#usage-1)

```

Billies-MacBook-Pro-2:git-github-lint billie$ bin/git-github-lint help git-github-lint:pr
Usage:
  git-github-lint:pr [options] [--]

Arguments:
  github-username       GitHub Username
  github-repository     GitHub Repository
  pull-request-id       The ID of the pull request

Options:
  -t, --token=TOKEN     The token to authenticate to the API with.
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
 Evaluates a the commits in a pull request and checks that their messages match the style advised by Git. It will then update the "status" in github (that little dot next to the commits).

 Here are some good articles on commit message style:

 * http://chris.beams.io/posts/git-commit/
 * https://git-scm.com/book/ch5-2.html#Commit-Guidelines
 * https://github.com/blog/926-shiny-new-commit-styles

```

#### Output While Running

[](#output-while-running)

```
$ php vendor/bin/git-github-lint git-github-lint:pr \
                                 -t my-token \
                                 PurpleBooth \
                                 git-github-lint \
                                 3

git-github-lint:pr
==================

 // Analysing PR PurpleBooth/git-github-lint#3

 [OK] Finished!
```

You can look at the [pull requests on this repo](https://github.com/PurpleBooth/git-github-lint/pull/3) to see what the effect is like in person.

### Library

[](#library)

You can use the whole library

```
