Skip to content
/ gitBahn Public

Rust CLI for autonomous Git operations with AI-powered commits, merges, code rewriting, reviews, auto git rewrites with atomic commits

Notifications You must be signed in to change notification settings

0xinit/gitBahn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitBahn

Autonomous Git operations with AI-powered commits, merges, and code rewriting.

Why gitBahn?

AI coding assistants can write entire projects in minutes. But when you commit that code, the git history tells a different story:

commit abc123  2025-01-10 14:32:01  feat: add complete trading bot
  28 files changed, 5278 insertions(+)

One massive commit. All files at once. Obviously AI-generated.

gitBahn transforms this into a realistic development history:

commit 9fd434c  Jan 03, 11:17  chore: initialize project with gitignore
commit 57cb30b  Jan 03, 13:12  feat: add environment configuration
commit 97096e8  Jan 03, 15:13  feat(utils): add shared constants
commit 2be67ce  Jan 03, 16:08  feat(storage): add data models
commit fd82b57  Jan 03, 17:56  feat(storage): implement Redis client
...47 commits over 2 days...
commit a504534  Jan 05, 02:23  docs: add comprehensive README

Small focused commits. Spread over time. Natural development progression.

Quick Start (Claude Code Plugin)

No installation required - just two commands:

# Step 1: Add the marketplace
/plugin marketplace add https://github.com/0xinit/gitBahn

# Step 2: Install the plugin
/plugin install gitbahn

Use

Just talk to Claude Code:

"Commit my changes"
"Create realistic commits spread over 4 hours"
"Split my changes into atomic commits"
"Create 10 commits spread over 2 days starting yesterday at 9am"

Available Commands

Command Description
/gitbahn:commit Smart commit with AI-generated message
/gitbahn:realistic Split by language constructs (imports → classes → functions)
/gitbahn:atomic One file per commit
/gitbahn:granular Split by diff hunks

Standalone CLI

For use outside Claude Code. Requires Anthropic API key.

Installation

cargo install --path .
export ANTHROPIC_API_KEY=your_key_here

Features

  • AI Commit: Generate intelligent commit messages from diffs
  • Auto Mode: Watch for changes and auto-commit with AI messages
  • Code Rewrite: Transform code with natural language instructions
  • AI Merge: Resolve merge conflicts automatically with AI
  • Code Review: Get AI-powered code reviews
  • Docs Generation: Generate documentation for your code

What gitBahn Offers

Feature Standard Git gitBahn
Custom timestamps Limited Full control
Spread commits over time Manual Automatic
Split 1 change → N commits Manual AI-powered
Split files by function Not possible Automatic
Realistic development flow Manual --realistic mode

Perfect For

  • Portfolio projects that showcase your work
  • Open source contributions with clean history
  • Teams that want organized, readable git logs
  • Anyone using AI assistants who wants natural-looking commits

CLI Usage

Commit with AI

# Generate AI commit message for staged changes
bahn commit

# Split into atomic commits
bahn commit --atomic

# Atomic commits with spread timestamps (human-like)
bahn commit --atomic --spread 4h

# Atomic commits with custom start time
bahn commit --atomic --spread 4h --start "2025-01-05 09:00"

# Split into exactly N commits
bahn commit --atomic --split 10

# Granular mode - split files into hunks for ultra-realistic commits
bahn commit --granular --spread 4h

# Granular with exact commit count
bahn commit -g --split 15 --spread 2h --start "2025-01-05 09:00"

# Auto-confirm without prompting
bahn commit -y

Realistic Mode (Maximum Authenticity)

# Simulate human development flow
bahn commit --realistic

# Target specific commit count spread over time
bahn commit --realistic --split 47 --spread 48h --start "2025-01-03 11:17"

# Short form with auto-confirm
bahn commit -r --split 30 --spread 24h -y

--realistic mode simulates how a human developer actually builds a project:

  1. Language-aware parsing - Understands Python, Rust, JavaScript/TypeScript, and Go
  2. Logical chunking - Splits files into imports, constants, classes, and individual methods
  3. Dependency ordering - Config files first, then utils, models, services, and finally entry points
  4. Progressive building - Large files grow across multiple commits (imports → class skeleton → methods)
  5. Natural interleaving - Work on module A, switch to B, come back to A

Commit Mode Comparison:

Mode Splits by Best for
--atomic Whole files Quick splitting
--granular Hunks (diff chunks) Modified files
--realistic Logical code units New projects, maximum authenticity

Autonomous Mode

# Watch and auto-commit changes (real-time)
bahn auto --watch

# Custom interval (seconds)
bahn auto --watch --interval 60

# Dry run - see what would be committed
bahn auto --dry-run

Human-like Commits (Stealth Mode)

# Interactive mode - prompt before each commit with timestamp choice
bahn auto --watch --prompt

# Deferred mode - collect commits, spread timestamps on exit
bahn auto --watch --defer --spread 4h

# Deferred with custom start time
bahn auto --watch --defer --spread 4h --start "2025-01-05 09:00"

--prompt mode asks you for each change:

  • Commit now (current time)
  • Commit with backdated time (e.g., "2h ago")
  • Add to batch (commit later with spread timestamps)
  • Skip

--defer mode collects all commits during your session, then creates them with randomly spread timestamps when you press Ctrl+C. Perfect for making AI-assisted coding look natural.

Code Rewrite

# Rewrite a file with AI
bahn rewrite src/main.rs --instructions "Add error handling"

# Rewrite entire directory
bahn rewrite src/ --instructions "Convert to async"

# Dry run
bahn rewrite src/main.rs --dry-run

AI Merge

# Merge with AI conflict resolution
bahn merge feature-branch --auto-resolve

Code Review

# Review staged changes
bahn review --staged

# Review specific commit
bahn review --commit abc123

# Strict review
bahn review --staged --strictness strict

Documentation

# Generate docs for a file
bahn docs src/main.rs

# Specify format
bahn docs src/lib.rs --format markdown

Status

# Show repository status
bahn status

License

MIT

About

Rust CLI for autonomous Git operations with AI-powered commits, merges, code rewriting, reviews, auto git rewrites with atomic commits

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages