|
1 |
| -# Git Commit Message Formatter |
| 1 | +# Git 50/72 Commit Message Formatter |
2 | 2 |
|
3 |
| -This is a Visual Studio Code extension that formats git commit messages in the source control input box. |
| 3 | +This is a Visual Studio Code extension that formats git commit messages in the source control input box according to the 50/72 rule. It also supports optional linting and quick fixes for missing `type:` subject line prefixes. |
4 | 4 |
|
5 |
| -## Features |
6 |
| - |
7 |
| -- Formats git commit messages according to a predefined style. |
8 |
| - |
9 |
| -## How to use |
| 5 | +## Usage |
10 | 6 |
|
11 | 7 | 1. Install the extension in VS Code.
|
12 |
| -2. Write a commit message in the source control input box. |
13 |
| -3. If the message exceeds the configured limit (`git.inputValidationLength`), a validation message will appear in the source control input box. Use the Quick Fix command (`Ctrl+.`) to access the `Format commit message` code action. |
| 8 | +2. Write a commit message in the source control view input box. |
| 9 | +3. If either the subject line or the body exceeds the configured limit, a validation message will appear in the source control input box. Use the Quick Fix command (`Ctrl+.`) to access and run the `Format commit message` code action. |
| 10 | + |
| 11 | + <video src="format-quick-fix.mp4" controls title="Commit message quick fix"></video> |
| 12 | +4. If your commit message lacks a `type:` prefix, a validation message will appear in the source control input box. Use the Quick Fix command (`Ctrl+.`) to access and run the `Add commit type` code action. |
14 | 13 |
|
15 |
| -<video src="format-quick-fix.mp4" controls title="Commit message quick fix"></video> |
| 14 | + <video src="commit-type-fix.mp4" controls title="Commit message type warning and quick fix"></video> |
| 15 | +5. Happy committing! |
16 | 16 |
|
17 |
| -4. Alternatively, enable `editor.formatOnType` to automatically format your commit message when you insert a newline. |
18 |
| -5. Enable lint warnings and quick fixes when your commit subject line does not start with a [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) type with `gitCommit.subjectLine.lint.enabled`. You can allowlist custom commit types using the `gitCommit.subjectLine.lint.types` setting. |
| 17 | +## Configuration options |
19 | 18 |
|
20 |
| -<video src="commit-type-fix.mp4" controls title="Commit message type warning and quick fix"></video> |
| 19 | +* Configure how long your commit message subject lines and bodies should be with the following settings: |
| 20 | + - `git.inputValidationSubjectLength` (default: 50 chars) |
| 21 | + - `git.inputValidationLength` (default: 72 chars) |
| 22 | +* Enable `editor.formatOnType` to automatically format your commit message when you insert a newline. |
| 23 | +* Configure whether you want validation and quick fixes for commit types in the subject line: |
| 24 | + - `gitCommit.subjectLine.lint.enabled`: (default: `false`) |
| 25 | + - `gitCommit.subjectLine.lint.types` (default: `feat:`, `fix:` [and other Conventional Commit types](https://www.conventionalcommits.org/en/v1.0.0/)) |
21 | 26 |
|
22 | 27 | ## Development
|
23 | 28 |
|
|
0 commit comments