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.
Lintje's output explains what's wrong by annotating your commit subject, message and branch name. See exactly where the problem is and how to resolve it. Lintje helps you 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 | = help: https://lintje.dev/docs/rules/commit-subject/#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://lintje.dev/docs/rules/commit-subject/#subjectcliche 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 | = help: https://lintje.dev/docs/rules/commit-message/#messagepresence 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 | = help: https://lintje.dev/docs/rules/branch/#branchnameticketnumber 2 commits and branch inspected, 4 errors detected