Skip to main content

Write good commits for your team

Lintje is an opinionated linter for Git, promoting team communication in Git.

Write a story

Good commits tell a story. They add necessary context to your file changes. For reviews and debugging sessions months from now.

  • 1
    Explain why the commit is needed
    Explain what error occurred or what issue a user reported. If the commit adds a new feature, explain why it was added. Refactoring a part of the code base? Describe how the old code wasn't working.
  • 2
    Describe what was changed
    In the commit message, explain why this implementation was chosen and what changes are especially important. List any alternatives that were considered and why they were not chosen. Write down the constraints that were present, like lack of time.
  • 3
    Link your sources
    Include links to documentation, issues, blog posts, other parts of the code or other projects you consulted to make this change. Provide as much context as possible.

Spot undescriptive commits

A well written commit saves you hours of debugging. Good commits help you get unstuck without waiting for team members to respond to your call for help.

Lintje helps you spot undescriptive commits and suggests steps to improve them.

Don't forget: good commits contain a message with more detail!

  • WIP
  • fix bug
  • closes #123
  • End of day backup
  • add test
  • [JIRA-123]

Resolve issues faster

Lintje helps resolve issues quickly. Lintje explains the issue by highlighting the problem is and showing how to resolve it.

$ 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
    |
    = help: https://r.lintje.dev/r/SubjectTicketNumber

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
    |
    = help: https://r.lintje.dev/r/SubjectCliche

2 commits and branch inspected, 2 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.