Code.-.Cargo.toml.ghit.-.23.June.2025.mp4
ghit is a CLI that uses AI to automatically generate meaningful Git commit messages and streamline your dev workflow.
- AI-Generated Commit Messages: Uses OpenAI's GPT models to analyze your changes and create descriptive commit messages
- Workflow Automation: Add files, generate message, commit, and push in one command
- Smart Diff Analysis: Automatically stages all modified files and analyzes multi-file changes
- Configurable Verbosity: Choose between quiet (one-line), normal (subject + body), or verbose commit messages
- Interactive Confirmation: Review and approve generated messages before committing
- Simple Configuration: Easy setup with a single TOML config file
Download the latest binary for your platform from the releases page:
macOS/Linux:
curl -L https://github.com/evisdrenova/ghit/releases/latest/download/ghit-$(uname -s)-$(uname -m).tar.gz | tar -xz
sudo mv ghit /usr/local/bin/
Windows:
Download ghit-windows.zip
from releases and add to your PATH.
git clone https://github.com/evisdrenova/ghit.git
cd ghit
cargo build --release
sudo cp target/release/ghit /usr/local/bin/
cargo install ghit
Create a .ghit.toml
file in your home directory (~/.ghit.toml
or C:\Users\YourName\.ghit.toml
):
model = "gpt-4.1" # any openai model
api_key = "your-openai-api-key-here"
message_level = "normal" # quiet, normal, or verbose
Automatic workflow (most common):
# Auto-stage all changes, generate message, commit, and push
ghit --auto
# Or simply (default behavior)
ghit
Generate message only:
# Generate commit message for staged changes (doesn't commit)
ghit --generate
Stage and generate:
# Add specific files and generate message (doesn't commit)
ghit --stage-and-generate src/main.rs src/lib.rs
# Add all changes and generate message
ghit --stage-and-generate
# Auto-commit only specific files
ghit --auto src/main.rs README.md
# Push to a specific branch
ghit --auto --branch feature-branch
# Stage specific files and generate message
ghit --stage-and-generate src/components/ tests/
Option | Description | Default |
---|---|---|
model |
OpenAI model to use (gpt-3.5-turbo , gpt-4 , etc.) |
none |
api_key |
Your OpenAI API key | Required |
message_level |
Commit message verbosity (quiet , normal , verbose ) |
normal |
Configure in ~/.ghit.toml
:
quiet
: One-line commit message onlynormal
: Subject line + short description (default)verbose
: Detailed subject + explanatory body
-
Make your changes to any files in your repository
-
Run ghit:
ghit --auto
-
Review the generated message:
Generated commit message: Subject: feat: add user authentication with JWT tokens Body: - Implement JWT-based authentication system - Add login and registration endpoints - Include middleware for protected routes - Update user model with password hashing Create this commit? [Y/n]:
-
Confirm by pressing Enter or 'y'
-
Done! Your changes are committed and pushed automatically
ghit analyzes your code changes and generates commit messages that follow best practices:
- Clear subject lines that summarize the change
- Conventional commit format (feat:, fix:, docs:, etc.)
- Detailed explanations of what changed and why
- Multi-file awareness that understands related changes across files
For a bug fix:
fix: resolve memory leak in image processing
- Fix buffer overflow in resize function
- Add proper cleanup for temporary arrays
- Update error handling for edge cases
For a new feature:
feat: implement dark mode toggle
- Add theme context provider
- Create toggle component with smooth transitions
- Persist user preference in localStorage
- Update all components to support both themes
ghit [OPTIONS] [FILES...]
OPTIONS:
-a, --auto Add files, generate message, commit, and push automatically
-b, --branch <BRANCH> Branch to push to (defaults to current branch)
-g, --generate Only generate commit message for staged changes
-s, --stage-and-generate Add files and generate message (don't commit)
-h, --help Print help message
EXAMPLES:
ghit # Auto-commit all changes (default)
ghit --auto # Same as above
ghit --branch main # Push to specific branch
ghit src/main.rs # Auto-commit specific file
ghit --generate # Just generate message for staged changes
ghit -s src/ tests/ # Stage files and generate message
"No changes found to commit"
- Make sure you have modified files in your repository
- Check
git status
to see if there are any changes
"Failed to load config"
- Ensure
.ghit.toml
exists in your home directory (~/.ghit.toml
) - Verify your OpenAI API key is correct and has credits
"OpenAI API error"
- Check your API key is valid and has available credits
- Verify your internet connection
- Try a different model (e.g.,
gpt-3.5-turbo
instead ofgpt-4
)
Permission denied when installing
- Use
sudo
when copying to/usr/local/bin/
- Or install to a directory in your PATH that you own
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make your changes and test them
- Use ghit to commit your changes!
- Push and create a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you find ghit useful, please consider:
- Starring the repository
- Reporting bugs or requesting features
- Contributing improvements
- Sharing with other developers