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.
- 🚀 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
brew install rona-rs/rona/ronaOr, if you prefer to tap explicitly:
brew tap rona-rs/rona
brew install ronacargo install ronaAfter installation, initialize Rona (optional, to set your preferred editor):
rona init [editor] # The editor to use for commit messages (default: nano)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)
# Editor for commit messages (any command-line editor)
editor = "nano" # Examples: "vim", "zed", "code --wait", "emacs"
# Custom commit types (defaults shown below)
commit_types = [
"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}
template = "[{commit_number}] ({commit_type} on {branch_name}) {message}"Note: When no configuration exists, Rona falls back to: ["chore", "feat", "fix", "test"]
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
template = "{?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
template = "{?commit_number}[{commit_number}] {/commit_number}({commit_type} on {branch_name}) {message}"
# Simple format without commit number
template = "({commit_type}) {message}"
# Conditional date with static text
template = "{?date}Date: {date} | {/date}{commit_type}: {message}"
# Multiple conditional blocks
template = "{?commit_number}#{commit_number} {/commit_number}{?author}by {author} - {/author}{message}"
# Include date and time conditionally
template = "{?date}[{date} {time}] {/date}{commit_type}: {message}"
# Custom format with optional commit number
template = "{?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}
# Initialize global configuration
rona init vim # Creates ~/.config/rona.toml
# Initialize project-specific configuration
cd my-project
rona init zed # Creates ./.rona.toml (overrides global)
# Change editor later
rona set-editor "code --wait" # Choose global or project scope interactively
# View current configuration
cat .rona.toml # Project config
cat ~/.config/rona.toml # Global config
# Customize commit types for your project
echo 'commit_types = ["feat", "fix", "refactor", "style", "docs"]' >> .rona.toml- Initialize Rona with your preferred editor:
# Initialize with various editors
rona init vim
rona init zed
rona init "code --wait" # VS Code
rona init emacs
# Initialize with default editor (nano)
rona init- Stage files while excluding specific patterns:
# Exclude Rust files
rona -a "*.rs"
# Exclude multiple file types
rona -a "*.rs" "*.tmp" "*.log"
# Exclude directories
rona -a "target/" "node_modules/"
# Exclude files with specific patterns
rona -a "test_*.rs" "*.test.js"- Generate and edit commit message:
# Generate commit message template (opens editor)
rona -g
# Interactive mode (input directly in terminal)
rona -g -i
# 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)
rona -c
# Create an unsigned commit (explicitly disable signing)
rona -c -u
# or
rona -c --unsigned
# Commit and push in one command
rona -c -p
# Commit with additional Git arguments
rona -c --no-verify
# Unsigned commit with push
rona -c -u -p
# Commit and push with specific branch
rona -c -p origin main# Create and switch to a new feature branch
git checkout -b feature/new-feature
rona -a "*.rs"
rona -g
rona -c -p
# Switch back to main and merge
git checkout main
git merge feature/new-feature
# Or use the sync command to update your branch with latest main
git checkout feature/new-feature
rona sync # Merges main into current branch
# Update branch with rebase instead of merge
rona sync --rebase # Rebases current branch onto main
# Create new branch and sync with develop
rona sync -b develop -n feature/new-feature
# Preview sync operation
rona sync --dry-run# Stage specific directories
rona -a "src/" "tests/"
# Exclude test files while staging
rona -a "src/" -e "test_*.rs"
# Stage everything except specific patterns
rona -a "*" -e "*.log" "*.tmp"# In your CI pipeline
rona init
rona -a "*"
rona -g
rona -c -p --no-verify# Fish shell
echo "function rona
command rona \$argv
end" >> ~/.config/fish/functions/rona.fish
# Bash
echo 'alias rona="command rona"' >> ~/.bashrc- Feature Development:
# Start new feature
git checkout -b feature/new-feature
rona -a "src/" "tests/"
rona -g # Select 'feat' type
rona -c -p- Bug Fixes:
# Fix a bug
git checkout -b fix/bug-description
rona -a "src/"
rona -g # Select 'fix' type
rona -c -p- Code Cleanup:
# Clean up code
git checkout -b chore/cleanup
rona -a "src/" -e "*.rs"
rona -g # Select 'chore' type
rona -c -p- Testing:
# Add tests
git checkout -b test/add-tests
rona -a "tests/"
rona -g # Select 'test' type
rona -c -p- Quick Commits (Interactive Mode):
# Fast workflow without opening editor
rona -a "src/"
rona -g -i # Select type and input message directly
rona -c -pAdd files to Git staging while excluding specified patterns.
rona add-with-exclude <pattern(s)>
# or
rona -a <pattern(s)>Example:
rona -a "*.rs" "*.tmp" # Exclude Rust and temporary filesCommit changes using prepared message. By default, automatically detects GPG availability and signs commits if possible.
rona commit [OPTIONS] [extra args]
# or
rona -c [-p | --push] [-u | --unsigned] [extra args]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)
rona -c
# Explicitly unsigned commit
rona -c -u
# Commit and push (with auto-detected signing)
rona -c -p
# Explicitly unsigned commit with push
rona -c -u -pGenerate shell completion scripts.
rona completion <shell>Supported shells: bash, fish, zsh, powershell
Example:
rona completion fish > ~/.config/fish/completions/rona.fishGenerate or update commit message template.
rona generate [--interactive] [--no-commit-number]
# or
rona -g [-i | --interactive] [-n | --no-commit-number]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
rona -g
# Interactive mode: Input message directly in terminal
rona -g -i
# Without commit number (useful with conditional templates)
rona -g -n
# Interactive mode without commit number
rona -g -i -nInteractive 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.
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"]
Initialize Rona configuration.
rona init [editor] # Any command-line editor (default: nano)Examples:
rona init vim
rona init zed
rona init "code --wait" # VS Code
rona init # Uses default (nano)Display repository status (primarily for shell completion).
rona list-status
# or
rona -lPush committed changes to remote repository.
rona push [extra args]
# or
rona -p [extra args]Set the default editor for commit messages.
rona set-editor <editor> # Any command-line editor (vim, zed, "code --wait", etc.)Examples:
rona set-editor vim
rona set-editor zed
rona set-editor "code --wait" # VS Code
rona set-editor emacs
rona set-editor nanoSync your current branch with another branch by pulling latest changes and merging or rebasing.
rona sync [OPTIONS]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
rona sync
# Sync with a different branch
rona sync --branch develop
rona sync -b staging
# Use rebase instead of merge
rona sync --rebase
rona sync -r
# Create new branch and sync with main
rona sync --new-branch feature/my-feature
rona sync -n bugfix/issue-123
# Create new branch and sync from develop using rebase
rona sync -b develop -r -n feature/new-feature
# Preview what would happen without making changes
rona sync --dry-run
# Combine all options
rona sync -b develop -r -n feature/test --dry-runCommon Use Cases:
# Keep feature branch up-to-date with main
git checkout feature/my-feature
rona sync
# Start new feature from latest main
rona sync -n feature/new-feature
# Update branch with staging before deploying
rona sync -b staging
# Rebase feature branch onto latest main for clean history
rona sync --rebaseDisplay help information.
rona help
# or
rona -hRona supports auto-completion for multiple shells using clap_complete.
Generate completion files for your shell:
# Generate completions for specific shell
rona completion fish # Fish shell
rona completion bash # Bash
rona completion zsh # Zsh
rona completion powershell # PowerShell
# Save to file
rona completion fish > ~/.config/fish/completions/rona.fishFish Shell:
# Copy to Fish completions directory
rona completion fish > ~/.config/fish/completions/rona.fishBash:
# Add to your .bashrc
rona completion bash >> ~/.bashrc
source ~/.bashrcZsh:
# Add to your .zshrc or save to a completions directory
rona completion zsh >> ~/.zshrcPowerShell:
# Add to your PowerShell profile
rona completion powershell | Out-File -Append $PROFILEThe completions include:
- All command and flag completions
- Git status file completion for
add-with-excludecommand (Fish only) - Context-aware suggestions
- Rust 2021 edition or later
- Git 2.0 or later
git clone https://github.com/rona-rs/rona.git
cd rona
cargo build --releaseContributions are welcome! Please feel free to submit a Pull Request.
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
For bugs, questions, and discussions please use the GitHub Issues.