An opinionated, terminal-based text editor for git commit messages, built with Textual.
- Title length warning: Characters beyond position 50 on the first line are highlighted in red
- Auto-wrap body text: Lines in the commit body (line 3+) are automatically wrapped at 72 characters (except for long strings that can't be wrapped, such as URLs)
- White space: Trailing white space is automatically stripped when a file is saved; an empty newline is inserted at the end of the file if not present.
- Signed-off-by toggle: Quickly add or remove a
Signed-off-bytrailer with a keyboard shortcut - Issue ID validation: Optionally enforce that commit titles start with an issue ID (e.g.
PROJ-123:) - Status bar: Shows current cursor position (line/column) and title length with warnings
# Using uv
uv tool install commit-editor
# Using pip
pip install commit-editor- Python 3.11 or later
- Git (for Signed-off-by functionality)
Configure commit-editor as your default git commit message editor:
git config --global core.editor commit-editorWhen you run git commit, the editor will open automatically.
commit-editor can also be used as a standalone tool with:
commit-editor path/to/file.txt| Shortcut | Action |
|---|---|
Ctrl+S |
Save the file |
Ctrl+Q |
Quit |
Ctrl+O |
Toggle Signed-off-by trailer |
Additional key bindings are noted in the Textual
TextArea documentation.
You can require commit titles to start with an issue ID by setting a regex pattern:
# Per-repository
git config commit-editor.issue-pattern 'PROJ-\d+'
# Global
git config --global commit-editor.issue-pattern 'PROJ-\d+'The pattern is matched against the start of the title and must be followed by a colon (:). For example, with
the pattern PROJ-\d+:
- valid:
PROJ-123: fix login bug - invalid:
fix login bug
This editor enforces the widely-accepted git commit message conventions:
- Title (line 1): Should be 50 characters or less; characters beyond 50 are highlighted in red as a warning.
- Blank line (line 2): Separates the title from the body.
- Body (line 3+): Should wrap at 72 characters; long lines are wrapped automatically as you type.
- Color theme support
MIT