Skip to main content

AI-powered Git assistant

Project description

GitGud - AI-Powered Git Assistant

Make Git operations effortless with intelligent analysis and recommendations

GitGud is a command-line tool that analyzes your Git repository and provides smart recommendations for push, pull, and commit operations. No more failed pushes, confusing errors, or Git anxiety!

Features

Repository Health Dashboard

See your repository state at a glance with a beautiful terminal UI:

$ gitgud status

╭─────────────────────────────────────────╮
│  Repository Health                      │
│  Repository  my-project                 │
│  Branch      main                       │
│  Remote      origin/main                │
│                                         │
│  Status      [OK] CLEAN                 │
│                                         │
│  Commits                                │
│    Ahead      0 commits                 │
│    Behind     0 commits                 │
│                                         │
│  Changes                                │
│    Modified     0 files                 │
│    Untracked    0 files                 │
╰─────────────────────────────────────────╯

Smart Commit Messages

Automatically generate descriptive commit messages from your changes:

$ gitgud commit

GitGud Smart Commit

Changes to be committed:
  Modified:  3 files
  Untracked: 1 files

Generating commit message...

Generated commit message:
┌────────────────────────────────────────┐
│ feat: add user authentication          │
│                                        │
│ - add auth service                     │
│ - add login component                  │
│ - update routes                        │
└────────────────────────────────────────┘

? What would you like to do?
  > Use this message
    Edit message
    Enter manually
    Cancel

Features:

  • Analyzes file changes and diff patterns
  • Follows Conventional Commits format (feat, fix, docs, etc.)
  • Interactive approval and editing
  • Optional AI enhancement with --ai flag

Smart Push

Intelligent push strategy based on repository state:

$ gitgud push

Analyzing repository...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Repository State
  Branch: feature/login
  Ahead:  3 commits
  Behind: 1 commit

Recommendation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Strategy: pull-then-push
Reasoning: Pull with rebase to maintain linear history

Commands:
  1. git pull --rebase origin feature/login
  2. git push origin feature/login

Execute? [Y/n]

Handles:

  • Ahead/behind scenarios
  • Uncommitted changes (auto-stash)
  • Divergent branches
  • Untracked remote branches

Divergent Branch Resolution

Interactive guidance when your branch has diverged:

$ gitgud resolve

Branch Divergence Detected

Your situation:
├─ You have 2 local commits
└─ Remote has 3 commits you don't have

Your Options:
1. Pull --rebase (RECOMMENDED)
   + Clean history, linear timeline
   - May cause conflicts

2. Pull (merge)
   + Safe & simple
   - Creates merge commit

3. Force push (DANGEROUS)
   ! DELETES teammate's work

Recommendation: git pull --rebase
? How would you like to resolve this? (Use arrows)
  > Pull with rebase (keeps history clean)
    Pull with merge (safer)
    Cancel

Installation

From PyPI (Recommended)

pip install gitgud-cli

From Source

git clone https://github.com/Syed-Masrur-Ahmed/GitGud.git
cd GitGud
pip install -e .

Optional: AI Enhancement

For experimental AI-powered features, install Ollama:

# Install Ollama (https://ollama.ai)
ollama pull codellama:7b

AI features are optional - GitGud works great with smart heuristics alone.

Usage

# Navigate to any Git repository
cd your-git-repo

# Check repository health
gitgud status

# Commit with auto-generated message
gitgud commit

# Commit with AI enhancement (experimental)
gitgud commit --ai

# Commit with manual message
gitgud commit -m "your message"

# Smart push
gitgud push

# Resolve divergent branches
gitgud resolve

# Show help
gitgud --help

Commands

Command Description
gitgud status Show repository health dashboard
gitgud commit Create commit with smart message generation
gitgud push Intelligent push with analysis
gitgud resolve Interactive divergent branch helper

Tech Stack

  • Python 3.9+
  • Click - CLI framework
  • Rich - Beautiful terminal output
  • GitPython - Git integration
  • Ollama - Optional AI enhancement (local, private)

How It Works

GitGud analyzes your repository using:

  1. Git state inspection - branches, commits, changes
  2. Pattern recognition - detects common scenarios
  3. Smart heuristics - rule-based recommendations
  4. Optional AI - LLM-powered insights (experimental)

All analysis happens locally. No data is sent to external services.

Configuration

GitGud works out of the box with sensible defaults. No configuration needed.

For AI features, ensure Ollama is running:

ollama serve

Contributing

Contributions welcome! Please feel free to submit issues and pull requests.

License

MIT License - see LICENSE file for details.

Author

Syed Masrur Ahmed


Make Git effortless. Install GitGud today!

pip install gitgud-cli

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

gitgud_cli-1.0.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

gitgud_cli-1.0.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gitgud_cli-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8ac58792ad1fb746f94b8182d45efe2892193d91ec6e26e11a6bcfa602325bd4
MD5 0dceef9b584cb5d44eb726cd7357944d
BLAKE2b-256 521308308af94241e730e1a38c7647e88d3a70d7094d00b1c0e949cc15014068

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gitgud_cli-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b7691c1414e866bcdea70d8a4aedaf8ad9c54d5eec9ba6331ec9e6d0be4fab0
MD5 9301936383594968506a1e04dd8a76ee
BLAKE2b-256 828305e6f2b01aeb2fe763fc5441f58f6857489f0a80dc490ef48dbfd5eedf1e

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