Skip to main content

A terminal-based git commit message editor with opinionated formatting

Project description

Commit Editor

PyPI Python License CI

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-by trailer with a keyboard shortcut
  • Status bar: Shows current cursor position (line/column) and title length with warnings

Installation

# Using uv
uv tool install commit-editor

# Using pip
pip install commit-editor

Requirements

  • Python 3.11 or later
  • Git (for Signed-off-by functionality)

Usage

Configure commit-editor as your default git commit message editor:

git config --global core.editor commit-editor

When 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

Keyboard Shortcuts

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.

Commit Message Format

This editor enforces the widely-accepted git commit message conventions:

  1. Title (line 1): Should be 50 characters or less; characters beyond 50 are highlighted in red as a warning.
  2. Blank line (line 2): Separates the title from the body.
  3. Body (line 3+): Should wrap at 72 characters; long lines are wrapped automatically as you type.

Future Improvements

  • Support adding a "Co-authored-by" trailer for AI attribution
  • Word-level spellchecking
  • Config file support (.commit.toml project or global level or pyproject.toml); support tweaking line length limits
  • Jira (or other issue tracker) ID checking (e.g. title starts with ABC-123: )
  • Color theme support

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commit_editor-0.3.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commit_editor-0.3.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file commit_editor-0.3.0.tar.gz.

File metadata

  • Download URL: commit_editor-0.3.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for commit_editor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 21e11d1443eba68adf27cd17e4e937d0e8fa29b12206a1a5ff0269d82c3b44ed
MD5 b5ebea6fe8408d2160e551bd54a602fe
BLAKE2b-256 e5f352eb6caac2b2a4529c91ffce740d8f1141534a81af99eb30003ef3c56e23

See more details on using hashes here.

File details

Details for the file commit_editor-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: commit_editor-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for commit_editor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6cffb758f47a3c43403117a20b081246938fc8bd0720053b922ec10419a1275
MD5 90c9e41010f11d8dae78eb845dfb60f6
BLAKE2b-256 5d4801d38c7f82f09fa08f3b7a7a7dd579d9421ed4a572189a3ee16ea73f527f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page