Skip to main content

A Git Linter for People

Lintje is a Git linter made for people. Not machines.

Lintje is an opinionated linter for Git, promoting communication in teams. Write commits for people reading them during reviews and debug sessions many months from now.

Write a story

Good commits tell a story. They add context to your Git commits and branches. A commit should explain the problem it solves, what the chosen solution is and what alternatives were considered.

Lintje helps by checking a variety of rules, from style to content. Some of these rules are:

  • The subject describes the change in detail. No "Fixing bugs" allowed.
  • The subject does not start with a prefix: fix, feat, doc, refactor, etc.
  • The subject has a maximum of 50 characters.
  • The message body contains a reference to the issue it's a part of.
  • Message body lines are a maximum of 72 characters, excluding URLs and code examples.
  • A commit should contain file changes.
  • Fixup and squash commits need to be rebased before merging.
  • Avoid merge commits in feature branches, rebase the branch instead.
  • Branch names describe the topic of the changes.
  • Branch names don't only include a ticket number.

Detailed help

Lintje doesn't just list a bunch of problems, it explains what's wrong and helps resolve issues quicker.

$ lintje
Error[SubjectTicketNumber]: The subject contains a ticket number
  883a427:1:10: Fix bug. Closes #123
    |
  1 | Fix bug. Closes #123
    |          ^^^^^^^^^^^ Remove the ticket number from the subject
   ~~~
  3 | Closes #123
    | ----------- Move the ticket number to the message body

Error[SubjectCliche]: The subject does not explain the change in much detail
  9a2ae29:1:1: Fix bug
    |
  1 | Fix bug
    | ^^^^^^^ Describe the change in more detail

Error[MessagePresence]: No message body was found
  9a2ae29:3:1: Fix bug
    |
  1 | Fix bug
  2 |
  3 |
    | ^ Add a message body with context about the change and why it was made

Error[BranchNameTicketNumber]: A ticket number was detected in the branch name
  Branch:1: fix-123
  |
  | fix-123
  | ^^^^^^^ Remove the ticket number from the branch name or expand the branch name with more details

2 commits and branch inspected, 4 errors detected

Get started

Learn more about how Lintje works and how to install it into your project.

Read more about the philosophy of Lintje by reading the post that inspired it.