Skip to main content

AI-powered Git workflow assistant โ€” commit, review, recover, and more with a single command

Project description

GitDude ๐Ÿง 

PyPI version Python 3.10+ License: MIT Downloads

GitDude is an AI-powered Git workflow assistant that turns plain English into git actions โ€” commit, review, recover, and understand your repo from the terminal.


โœจ Features

  • ๐Ÿค– Multi-provider AI โ€” Gemini (default, free), Groq (fastest), Ollama (100% local), OpenAI
  • ๐Ÿ’ฌ Natural language commands โ€” gitdude do "stash, switch to main, pull"
  • ๐Ÿ” AI code review โ€” bugs, security issues, quality flags before you push
  • ๐ŸŒฟ Smart branch naming โ€” gitdude branch "fix login problem"
  • โœ‚๏ธ Commit splitting โ€” gitdude split messy changes into logical commits
  • ๐Ÿ’ฌ Codebase chat โ€” gitdude chat "how does X work?"
  • ๐Ÿš‘ Emergency recovery โ€” gitdude whoops diagnoses and fixes git disasters
  • ๐Ÿ“‹ PR generation โ€” full GitHub PR description, auto-copied to clipboard
  • ๐ŸŽจ Beautiful Rich UI โ€” tables, panels, spinners, color-coded output
  • ๐Ÿ” Secure config โ€” keys stored in ~/.gitdude/config.json, never in .env

๐Ÿš€ Quick Start

# 1. Install
pip install gitdude

# 2. Configure (takes 60 seconds)
gitdude config

# 3. Generate an AI commit message and push
gitdude push

# 4. Ask about your code
gitdude chat "what does this project do?"

# 5. Review your code before merging
gitdude review

# 6. Something went wrong? Ask for help
gitdude whoops

๐Ÿ“ฆ Installation

pip install gitdude

Python 3.10+ required.


๐Ÿ”‘ Provider Setup

Google Gemini (Default โ€” Free)

  1. Get an API key from Google AI Studio
  2. Run gitdude config โ†’ choose gemini โ†’ paste key

Groq (Fastest Free Tier)

  1. Get a key at console.groq.com/keys
  2. Run gitdude config โ†’ choose groq โ†’ paste key

Ollama (100% Local/Offline)

  1. Install Ollama: ollama.ai
  2. Pull a model: ollama pull llama3
  3. Run gitdude config โ†’ choose ollama (no key needed)

OpenAI

  1. Get a key at platform.openai.com
  2. Run gitdude config โ†’ choose openai โ†’ paste key

๐Ÿ“– Command Reference

gitdude push

AI-generates a commit message for your changes, lets you confirm/edit, then commits and pushes.

gitdude push                      # Stage all โ†’ AI commit โ†’ push
gitdude push --no-confirm         # Skip confirmation
gitdude push --dry-run            # Preview only, don't execute
gitdude push --style freeform     # Use freeform (not conventional) commit style

Commit types (conventional): feat, fix, chore, docs, refactor, style, test, perf, ci


gitdude sync

Fetch + rebase. If there are merge conflicts, AI explains what's conflicting and gives exact resolution steps.

gitdude sync
gitdude sync --dry-run

gitdude back

Shows last 30 commits in a table. Pick one to go back to, choose a mode.

gitdude back
gitdude back --dry-run

Modes: soft (keep changes staged), hard (discard changes), checkout (detached HEAD), branch (new branch from that commit)


gitdude undo "<description>"

Describe what went wrong โ€” AI reads your log and reflog to determine the safest recovery.

gitdude undo "I accidentally committed my .env file"
gitdude undo "I deleted the wrong branch"
gitdude undo "I made a mess of the last 3 commits" --dry-run

gitdude do "<natural language>"

Convert plain English into a sequence of git commands, preview, then execute.

gitdude do "stash my changes, switch to main, pull latest"
gitdude do "create a new branch called feature/auth and push it"
gitdude do "squash my last 3 commits" --dry-run

If any command fails, AI reads the error and suggests a fix.


gitdude review

Diffs your current branch vs main/master, then AI reviews for bugs, security issues, and quality.

gitdude review
gitdude review --base develop     # Compare against a different branch
gitdude review --dry-run          # Show diff without AI review

Review sections: Summary ยท โš ๏ธ Potential Bugs ยท ๐Ÿ”’ Security Issues ยท ๐Ÿ“ Code Quality ยท ๐Ÿ” Things to Check ยท โœ… Overall Assessment


gitdude branch "<description>"

AI-generates a clean, conventional branch name from your description.

gitdude branch "fix the login timeout bug"
# โ†’ Suggests: fix/login-timeout-bug
# โ†’ Prompts: create branch / edit name / cancel

gitdude split

The ultimate tool for messy working trees. AI analyzes all your changes and groups them into logical, atomic commits.

gitdude split
# โ†’ Groups files + generates commit messages
# โ†’ Interactive loop to commit each group one-by-one

gitdude chat "<question>"

Ask questions about your codebase. It reads your file tree, README, and recent history to provide specific answers.

gitdude chat "how do I add a new command to this app?"
gitdude chat "where is the AI provider logic located?"

gitdude pr

Generates a complete PR title + description + bullet list + testing notes. Auto-copies to clipboard.

gitdude pr
gitdude pr --base develop         # Compare against develop
gitdude pr --no-copy              # Don't copy to clipboard

gitdude explain

Reads your last 5 reflog entries and explains in plain English what happened.

gitdude explain

gitdude whoops

Emergency recovery. Feeds git status + log + reflog to AI. Diagnoses what went wrong and gives step-by-step recovery.

gitdude whoops
gitdude whoops --dry-run          # Diagnose only, don't execute

gitdude config

Interactive configuration wizard.

gitdude config                    # Run setup
gitdude config --show             # Print current config (keys masked)
gitdude config --reset            # Wipe config and redo setup

Stored settings:

  • AI provider (gemini / groq / ollama / openai)
  • API key per provider
  • Model name per provider
  • Default branch (main or master)
  • Commit style (conventional or freeform)

๐Ÿ—๏ธ Architecture

gitdude/
โ”œโ”€โ”€ main.py        # Typer app โ€” all command definitions
โ”œโ”€โ”€ ai.py          # Unified AI provider wrapper (ask_ai)
โ”œโ”€โ”€ git_ops.py     # GitPython operations (diff, log, push, resetโ€ฆ)
โ”œโ”€โ”€ config.py      # Config at ~/.gitdude/config.json
โ””โ”€โ”€ utils.py       # Rich panels, tables, prompts, helpers

AI Providers (ai.py):

Provider SDK Default Model Speed Cost
gemini google-generativeai gemini-2.0-flash Fast Free tier
groq groq llama-3.3-70b-versatile Fastest Free tier
ollama ollama llama3 Local Free (local)
openai openai gpt-4o-mini Fast Pay per use

All providers go through a single interface: ask_ai(prompt) -> str with spinner feedback and unified error handling.


๐Ÿ›ก๏ธ Safety Features

  • โœ… All destructive operations (hard reset, force push, etc.) require explicit confirmation
  • โœ… --dry-run flag available on all mutating commands
  • โœ… Color-coded risk levels โ€” green (safe), yellow (caution), red (destructive)
  • โœ… No tracebacks โ€” all exceptions caught and shown as friendly Rich error panels
  • โœ… API keys stored privately in ~/.gitdude/config.json, never in project files

๐Ÿค Contributing

  1. Fork the repo
  2. Create a feature branch: git checkout -b feat/amazing-feature
  3. Make your changes
  4. Run linting: ruff check .
  5. Open a PR โ€” or just use gitdude pr to generate your PR description! ๐Ÿ˜„

Dev setup:

git clone https://github.com/utkarshgupta188/gitdude
cd gitdude
pip install -e ".[dev]"

๐Ÿ“„ License

MIT ยฉ GitDude Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitdude-1.4.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitdude-1.4.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file gitdude-1.4.0.tar.gz.

File metadata

  • Download URL: gitdude-1.4.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitdude-1.4.0.tar.gz
Algorithm Hash digest
SHA256 cf3c59120af7ef02b784ad4ee39194892e7398dbd8a4fe197d661ea23a493de1
MD5 2d18fb6806453b12f4a535e489f688f2
BLAKE2b-256 b29eea060f0675745eb5e664bc3ea89edd1ba3ed8b1c9ce66c35219c5db96c0a

See more details on using hashes here.

File details

Details for the file gitdude-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: gitdude-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitdude-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3848132800a401362fc637f6c68cfd5886a7274f866deedac2e2c8c482802410
MD5 613be5efcaf1be8dc2c82985a3c04183
BLAKE2b-256 bba05de65c4080f85ff6856a44bf151120309246fd590ac33e68737190324e46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page