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
  • ๐Ÿš‘ 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. Review your code before merging
gitdude review

# 5. 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 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.0.2.tar.gz (17.4 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.0.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitdude-1.0.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for gitdude-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a574eebdb243a8cab6e91619a3445ada548e452fa133bbabca9bcea978e402eb
MD5 a7cb287ef85b9fc1b21868f3ef9eb650
BLAKE2b-256 29196195ca040a810ae33867f6f414946645f22a5a8ed21ba08e4141626addd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gitdude-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for gitdude-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b912e2a3a0b14ca88b799b95e0ea57518b3d78587cb76617e011a10af8a3595
MD5 91ff3660f3ce62ad4d7fb7c1384cb884
BLAKE2b-256 90aedf9248906f6548acbfe65f55b8567d13ba012923fe3d59253f7b60961f64

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