A powerful CLI tool to streamline your Git workflow
Overview
Rona is a command-line interface tool designed to enhance your Git workflow with powerful features and intuitive commands. It simplifies common Git operations and provides additional functionality for managing commits, files, and repository status.
Features
- Intelligent file staging with pattern exclusion
- Structured commit message generation
- Streamlined push operations
- Branch synchronization with merge/rebase support
- Interactive commit type selection with customizable types
- Multi-shell completion support (Bash, Fish, Zsh, PowerShell)
- Flexible configuration system (global and project-level)
- Colored interactive prompts powered by Inquire
- Structured logging via
tracingwithRUST_LOGsupport
Installation
Homebrew (macOS/Linux)
Or, if you prefer to tap explicitly:
Cargo (Alternative)
After installation, initialize Rona (optional, to set your preferred editor):
Configuration
Rona supports flexible configuration through TOML files:
- Global config:
~/.config/rona.toml- applies to all projects - Project config:
./.rona.toml- applies only to the current project (overrides global)
Configuration Options
# Editor for commit messages (any command-line editor)
= "nano" # Examples: "vim", "zed", "code --wait", "emacs"
# Custom commit types (defaults shown below)
= [
"feat", # New features
"fix", # Bug fixes
"docs", # Documentation changes
"test", # Adding or updating tests
"chore" # Maintenance tasks
]
# Template for interactive commit message generation
# Available variables: {commit_number}, {commit_type}, {branch_name}, {message}, {date}, {time}, {author}, {email}
= "{?commit_number}[{commit_number}] {/commit_number}({commit_type} on {branch_name}) {message}"
Note: When no configuration exists, Rona falls back to: ["chore", "feat", "fix", "test"]
Template Configuration
Rona supports customizable templates for interactive commit message generation. You can define how your commit messages are formatted using variables:
Available Template Variables:
{commit_number}- The commit number (incremental){commit_type}- The selected commit type (feat, fix, etc.){branch_name}- The current branch name{message}- Your input message{date}- Current date (YYYY-MM-DD){time}- Current time (HH:MM:SS){author}- Git author name{email}- Git author email
Conditional Blocks:
You can use conditional blocks to include or exclude content based on whether a variable has a value. This is useful for handling optional elements like commit numbers.
Syntax: {?variable_name}content{/variable_name}
The content inside the block will only be included if the variable has a non-empty value.
Example with -n flag:
# Template with conditional commit number
= "{?commit_number}[{commit_number}] {/commit_number}({commit_type} on {branch_name}) {message}"
Results:
rona -g(with commit number):[42] (feat on new-feature) Add featurerona -g -n(without commit number):(feat on new-feature) Add feature
This eliminates empty brackets when using the -n flag!
Template Examples:
# Default template with conditional commit number
= "{?commit_number}[{commit_number}] {/commit_number}({commit_type} on {branch_name}) {message}"
# Simple format without commit number
= "({commit_type}) {message}"
# Conditional date with static text
= "{?date}Date: {date} | {/date}{commit_type}: {message}"
# Multiple conditional blocks
= "{?commit_number}#{commit_number} {/commit_number}{?author}by {author} - {/author}{message}"
# Include date and time conditionally
= "{?date}[{date} {time}] {/date}{commit_type}: {message}"
# Custom format with optional commit number
= "{?commit_number}Commit {commit_number}: {/commit_number}{commit_type} on {branch_name} - {message}"
Note: If no template is specified, Rona uses the default format: {?commit_number}[{commit_number}] {/commit_number}({commit_type} on {branch_name}) {message}
Working with Configuration
# Initialize global configuration
# Initialize project-specific configuration
# Change editor later
# View current configuration
# Customize commit types for your project
Usage Examples
Basic Workflow
- Initialize Rona with your preferred editor:
# Initialize with various editors
# Initialize with default editor (nano)
- Stage files while excluding specific patterns:
# Exclude Rust files
# Exclude multiple file types
# Exclude directories
# Exclude files with specific patterns
- Generate and edit commit message:
# Generate commit message template (opens editor)
# Interactive mode (input directly in terminal)
# This will:
# 1. Open an interactive commit type selector
# 2. Create/update commit_message.md
# 3. Either open your configured editor (default) or prompt for simple input (-i)
- Commit and push changes:
# Commit with the prepared message (auto-detects GPG and signs if available)
# Create an unsigned commit (explicitly disable signing)
# or
# Commit and push in one command
# Commit with additional Git arguments
# Unsigned commit with push
# Commit and push with specific branch
Advanced Usage
Working with Multiple Branches
# Create and switch to a new feature branch
# Switch back to main and merge
# Or use the sync command to update your branch with latest main
# Update branch with rebase instead of merge
# Create new branch and sync with develop
# Preview sync operation
Handling Large Changes
# Stage specific directories
# Exclude test files while staging
# Stage everything except specific patterns
Using with CI/CD
# In your CI pipeline
Shell Integration
# Fish shell
# Bash
Common Use Cases
- Feature Development:
# Start new feature
- Bug Fixes:
# Fix a bug
- Code Cleanup:
# Clean up code
- Testing:
# Add tests
- Quick Commits (Interactive Mode):
# Fast workflow without opening editor
Command Reference
add-with-exclude (-a)
Add files to Git staging while excluding specified patterns.
)>
# or
)>
Example:
commit (-c)
Commit changes using prepared message. By default, automatically detects GPG availability and signs commits if possible.
# or
Options:
-p, --push- Push after committing-u, --unsigned- Create unsigned commit (explicitly disable signing)--dry-run- Preview what would be committed
Examples:
# Auto-detected signing (default behavior)
# Explicitly unsigned commit
# Commit and push (with auto-detected signing)
# Explicitly unsigned commit with push
completion
Generate shell completion scripts.
Supported shells: bash, fish, zsh, powershell
Example:
generate (-g)
Generate or update commit message template.
# or
Features:
- Creates
commit_message.mdand.commitignore - Interactive commit type selection
- Automatic file change tracking
- Interactive mode: Input commit message directly in terminal (
-iflag) - Editor mode: Opens in configured editor (default behavior)
- No commit number: Omit commit number from message (
-nflag)
Options:
-i, --interactive- Input commit message directly in terminal instead of opening editor-n, --no-commit-number- Generate commit message without commit number
Examples:
# Standard mode: Opens commit type selector, then editor
# Interactive mode: Input message directly in terminal
# Without commit number (useful with conditional templates)
# Interactive mode without commit number
Interactive Mode Usage:
When using the -i flag, Rona will:
- Show the commit type selector (uses configured types or defaults: feat, fix, docs, test, chore)
- Prompt for a single commit message input
- Generate a clean format using your template (or default)
- Save directly to
commit_message.mdwithout file details
No Commit Number Flag:
The -n flag sets commit_number to None, which works perfectly with conditional templates:
- With conditional template:
{?commit_number}[{commit_number}] {/commit_number}({commit_type}) {message} - Result with
-n:(feat) Add feature(no empty brackets!) - Result without
-n:[42] (feat) Add feature
This is perfect for quick, clean commits without the detailed file listing.
Prompt UI and Colors
Rona uses the inquire crate for interactive prompts with a custom color scheme applied globally:
- Prompt prefix:
$(light red) - Answered prefix:
✔(light green) - Highlighted option prefix:
➠(light blue) - Prompt label: light cyan + bold
- Help message: dark yellow + italic
- Answer text: light magenta + bold
- Default values: light blue; placeholders: black
If you prefer different colors, you can fork and adjust the render configuration in src/cli.rs (function get_render_config). You can also override styles for a specific prompt using with_render_config(...) on that prompt.
Commit Types:
- Uses commit types from your configuration (
.rona.tomlor~/.config/rona.toml) - Falls back to:
["chore", "feat", "fix", "test"]when no configuration exists - Default configuration includes:
["feat", "fix", "docs", "test", "chore"]
init (-i)
Initialize Rona configuration.
Examples:
list-status (-l)
Display repository status (primarily for shell completion).
# or
push (-p)
Push committed changes to remote repository.
# or
set-editor (-s)
Set the default editor for commit messages.
Examples:
sync
Sync your current branch with another branch by pulling latest changes and merging or rebasing.
Options:
-b, --branch <BRANCH>- Branch to sync from (default: main)-r, --rebase- Use rebase instead of merge-n, --new-branch <NAME>- Create a new branch before syncing--dry-run- Preview what would be done
Workflow:
- Optionally creates a new branch (if
-nspecified) - Switches to the source branch
- Pulls latest changes from remote
- Switches back to your target branch
- Merges or rebases the source branch into your target branch
Examples:
# Basic usage: sync current branch with main
# Sync with a different branch
# Use rebase instead of merge
# Create new branch and sync with main
# Create new branch and sync from develop using rebase
# Preview what would happen without making changes
# Combine all options
Common Use Cases:
# Keep feature branch up-to-date with main
# Start new feature from latest main
# Update branch with staging before deploying
# Rebase feature branch onto latest main for clean history
help (-h)
Display help information.
# or
Shell Completion
Rona supports auto-completion for multiple shells using clap_complete.
Generate Completions
Generate completion files for your shell:
# Generate completions for specific shell
# Save to file
Installation by Shell
Fish Shell:
# Copy to Fish completions directory
rona completion fish > ~/.config/fish/completions/rona.fish
Bash:
# Add to your .bashrc
Zsh:
# Add to your .zshrc or save to a completions directory
PowerShell:
# Add to your PowerShell profile
rona completion powershell | Out-File -Append $PROFILE
Features
The completions include:
- All command and flag completions
- Git status file completion for
add-with-excludecommand (Fish only) - Context-aware suggestions
Debugging and Logging
Rona uses the tracing ecosystem for structured, filterable log output. All internal debug information (git command decisions, signing checks, file staging counts, etc.) is emitted as debug-level trace events rather than unconditional println! calls.
Enabling Debug Output
Via the --verbose flag:
The -v / --verbose flag sets the minimum log level to debug, which reveals all internal operations:
Example output with --verbose:
2024-01-15T14:30:00.123Z DEBUG Committing files... unsigned=false dry_run=false
2024-01-15T14:30:00.124Z DEBUG GPG signing decision should_sign=true
2024-01-15T14:30:00.250Z DEBUG commit successful!
2024-01-15T14:30:00.251Z DEBUG Running git push args=[] dry_run=false
2024-01-15T14:30:01.100Z DEBUG push successful!
Via the RUST_LOG environment variable:
RUST_LOG takes precedence over --verbose and provides fine-grained module-level filtering using the standard EnvFilter syntax.
# Show all debug output (equivalent to --verbose)
RUST_LOG=debug
# Show debug output only for the remote module (push/pull)
RUST_LOG=rona::git::remote=debug
# Show debug output only for staging
RUST_LOG=rona::git::staging=debug
# Show debug output for commit operations
RUST_LOG=rona::git::commit=debug
# Show debug output for branch operations
RUST_LOG=rona::git::branch=debug
# Combine multiple filters
RUST_LOG=rona::git::commit=debug,rona::git::remote=debug
# Show trace-level output (most verbose, includes span entry/exit)
RUST_LOG=trace
Log Levels
| Level | When emitted |
|---|---|
warn |
Always (default). GPG warnings, missing config, etc. |
debug |
With --verbose or RUST_LOG=debug. Internal decisions. |
trace |
Only with RUST_LOG=trace. Span entry and exit events. |
Available Modules for Filtering
| Module | Content |
|---|---|
rona::git::branch |
Switch, create branch, pull, merge, rebase |
rona::git::commit |
Commit creation, GPG signing detection |
rona::git::remote |
Push operations |
rona::git::staging |
File staging with pattern exclusion |
rona::git |
Cross-module git output (handle_output) |
How It Works
Rona initializes a tracing-subscriber once at startup in cli::run(), immediately after parsing CLI arguments. The subscriber respects RUST_LOG first; if that variable is absent, it falls back to "debug" when --verbose is set and "warn" otherwise.
Functions that perform meaningful git work are annotated with #[tracing::instrument], so enabling trace-level output also records span entry and exit with the relevant parameters automatically.
Architecture
Git Operations: git2 vs Command
Rona uses the git2 library (libgit2 bindings) for most Git operations, providing better error handling, no dependency on the git CLI being installed, and avoidance of path/shell issues.
Operations using git2 (library):
- Repository discovery and path resolution
- Status and file staging
- Branch info, switching, and creation
- Commit creation (both unsigned and GPG-signed)
- Git config reading (author info, signing keys, default branch)
- Commit counting and history walking
Operations using std::process::Command (CLI):
- Push -- git2's push requires complex
RemoteCallbacksfor SSH/HTTP authentication - Pull -- No direct pull API in git2; would need fetch (with auth callbacks) + merge
- Merge / Rebase -- git2's low-level APIs require manual conflict resolution and commit iteration
- GPG signing checks -- These run the
gpgbinary, not git
For GPG-signed commits, Rona uses a hybrid approach: git2's commit_create_buffer generates the commit content, the gpg CLI signs it, and git2's commit_signed stores the result.
Development
Requirements
- Rust 2021 edition or later
- Git 2.0 or later (only needed for push, pull, merge, rebase operations)
Building from Source
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Support
For bugs, questions, and discussions please use the GitHub Issues.