fastcommit is a command-line tool designed to help developers quickly generate standardized commit messages. It supports multiple languages and detail levels, and can automatically generate commit messages based on file differences.
-- 中文文档:README_CN.md
You can install fastcommit using the following method:
# Install using cargo
cargo install --git https://github.com/fslongjin/fastcommit --tag v0.5.1git add .
fastcommitNOTE: All common config can be configured via ~/.fastcommit/config.toml
-d, --diff-file <DIFF_FILE>: Specify the path to the file containing the differences.--conventional <CONVENTIONAL>: Enable or disable conventional commit style analysis. Acceptable values aretrueorfalse.-l, --language <LANGUAGE>: Specify the language for the commit message. Acceptable values areen(English) orzh(Chinese).-b, --generate-branch: Generate branch name.--branch-prefix: prefix of the generated branch name
-m, --message: Generate commit message (use with -b to output both)-v, --verbosity <VERBOSITY>: Set the detail level of the commit message. Acceptable values areverbose(detailed),normal, orquiet(concise). The default isquiet.-p, --prompt <PROMPT>: Additional prompt to help AI understand the commit context.-r, --range <RANGE>: Specify diff range for generating commit message (e.g. HEAD~1, abc123..def456).--no-wrap: Disable text wrapping for long lines.--wrap-width <WIDTH>: Set custom line width for text wrapping (default: config file setting or 80).-h, --help: Print help information.-V, --version: Print version information.
-
Generate a commit message using default settings:
fastcommit -d changes.diff
-
Enable conventional commit style and specify the Chinese language:
fastcommit -d changes.diff --conventional true -l zh -
Set the detail level to
verbose:fastcommit -d changes.diff -v verbose
-
Provide additional context to help AI understand the commit:
fastcommit -d changes.diff -p "Fixed login page styling issues, especially button alignment" -
Generate branch name only:
fastcommit -b
-
Generate both branch name and commit message:
fastcommit -b -m
-
Generate commit message for a specific diff range:
# Generate commit message for the last commit fastcommit -r HEAD~1 # Generate commit message for a range of commits fastcommit -r abc123..def456
-
Control text wrapping behavior:
# Disable text wrapping fastcommit --no-wrap # Set custom line width fastcommit --wrap-width 60 # Combine with other options fastcommit -b -m --wrap-width 100
Contributions of code or suggestions are welcome! Please read the Contributing Guide first.
This project is licensed under the MIT License.