{"id":51234710,"url":"https://github.com/krishnakanthb13/git-commit","last_synced_at":"2026-06-28T19:03:24.443Z","repository":{"id":366637803,"uuid":"1277151267","full_name":"krishnakanthb13/git-commit","owner":"krishnakanthb13","description":"🤖 AI-powered Git commit workflow assistant using Google Gemini. Zero-dependency Python CLI that generates conventional commit messages, manages semantic versioning, and automates the full commit-to-deployment lifecycle. Features interactive staging, session recovery, CI/CD integration, and smart context detection.","archived":false,"fork":false,"pushed_at":"2026-06-22T18:04:43.000Z","size":131,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-22T18:24:39.162Z","etag":null,"topics":["ai","cli","commit","conventional-commits","developer-tools","gemini","git","productivity","python","semantic-versioning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krishnakanthb13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-22T16:20:23.000Z","updated_at":"2026-06-22T18:04:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/krishnakanthb13/git-commit","commit_stats":null,"previous_names":["krishnakanthb13/git-commit"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/krishnakanthb13/git-commit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishnakanthb13%2Fgit-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishnakanthb13%2Fgit-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishnakanthb13%2Fgit-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishnakanthb13%2Fgit-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krishnakanthb13","download_url":"https://codeload.github.com/krishnakanthb13/git-commit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishnakanthb13%2Fgit-commit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34900375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cli","commit","conventional-commits","developer-tools","gemini","git","productivity","python","semantic-versioning"],"created_at":"2026-06-28T19:03:23.724Z","updated_at":"2026-06-28T19:03:24.436Z","avatar_url":"https://github.com/krishnakanthb13.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI-Powered Git Commit \u0026 Version Bumper Tool\n\nA professional, zero-dependency Python CLI tool that uses Google's Gemini API (specifically optimized for `gemini-3.1-flash-lite`) to analyze your git diffs, interactively stage files, generate structured commit summaries/descriptions in a single API call, and automatically manage semantic version updates. Includes powerful amend capabilities to update or replace previous commit messages.\n\n## Workflow\n\n```\n1. Stage files → 2. Choose mode (n/a/f) → 3. Provide context → \n4. AI generates/loads message → 5. Review \u0026 confirm (with validation) → \n6. Commit/Amend → 7. Push (with force-push warning for amends) → \n8. Create PR \u0026 Monitor CI (optional)\n```\n\n## Overview\n\n**An AI-powered Git commit workflow assistant** that:\n\n1. 🔍 **Analyzes changes** with Git diff\n2. 🤖 **Generates commit messages** using Google's Gemini AI\n3. 📝 **Follows conventional commits** format (auto-detected from repo history)\n4. 🔄 **Three commit modes** for flexible history management:\n   - **New commit**: Create a fresh commit with version bump and tag\n   - **Amend**: Update last commit message and add staged changes (no version bump)\n   - **Fresh amend**: Replace last commit message completely with new AI suggestion (no version bump)\n5. 🏷️ **Manages version bumping** (patch/minor/major/custom/none)\n6. 📦 **Updates project files** (package.json, pyproject.toml)\n7. 📋 **Maintains changelogs** (CHANGELOG.md)\n8. ✅ **Runs pre-commit hooks** before committing\n9. 🔍 **Detects binary files** and scopes from file paths\n10. 🔗 **Links issues** from branches/commits\n11. 💾 **Saves session state** for crash recovery (includes commit mode and amend state)\n12. 🚀 **Pushes to remote** with multiple tags support, force push warnings for amended commits, and remote tag conflict prompts\n13. 🔧 **Creates Pull Requests** via GitHub CLI\n14. 👀 **Monitors CI pipelines** after push\n15. 🎨 **Beautiful CLI interface** with colors\n16. ⚙️ **Configuration file** support (.commitgenrc)\n17. 🏃 **CI/CD ready** with non-interactive mode\n18. 🧪 **Dry run mode** for testing\n19. 🔍 **Validates commit messages** against conventional commit format (72 char limit, proper format, blank line)\n20. 📊 **Shows commit statistics** with per-extension file counts\n21. 🔤 **Spell checking** integration (via aspell)\n22. 🔄 **Unstage files** during staging with interactive picker\n23. 📝 **Loads commit templates** from `.git/COMMIT_TEMPLATE` or `.github/PULL_REQUEST_TEMPLATE.md`\n24. 📦 **GitHub Repository Creation**: Auto-prompts to create a public/private repository on GitHub and push code/tags when no git remote is configured.\n25. 🔁 **Continuous Sessions**: Prompts to optionally restart the tool after completion or errors, allowing multiple commits in a single run without dropping back to the shell.\n\n**A comprehensive Git commit tool** that handles the entire workflow from staging to CI monitoring with excellent error handling and user experience.\n\n## Features\n\n- 🔋 **Zero Dependencies**: Requires only standard Python 3 libraries. No `pip install` required.\n- ⚡ **Highly Efficient**: Single structured JSON API call with 60-second timeouts to prevent hanging. Smartly optimizes and truncates large diffs while preserving file headers.\n- 🔄 **Powerful Amend Workflow**: Three commit modes for flexible history management:\n  - **New**: Create a fresh commit with version bump and tag\n  - **Amend**: Update the last commit message and add new staged changes (preserves original as context)\n  - **Fresh Amend**: Completely replace the last commit message with AI-generated content\n  - Smart force-push detection for amended commits\n  - Session recovery preserves commit mode across crashes\n- 📦 **Semantic Versioning**: Auto-detects version from git tags, recent commit messages, `package.json`, or `pyproject.toml` and updates those files on commit. Automatically stages version files after a bump. Resolves version mismatches interactively across all sources. Skips version bump for amend mode by default. Includes local version collision detection (warnings when proposed bump already exists as a local tag) and remote tag check to prompt before overwriting.\n- 📜 **Changelog \u0026 PR Management**: Automatically updates `CHANGELOG.md` and can create GitHub Pull Requests using `gh` CLI.\n- 🤖 **Smart Context**: Detects architectural scope from file paths, extracts issue numbers from branch names, respects `.git/COMMIT_TEMPLATE` and `.github/PULL_REQUEST_TEMPLATE.md`, and learns from your repo's commit history. For amend mode, includes the original commit message as context.\n- 🔒 **Robustness**: Binary file existence checks, pre-commit hook integration, session recovery (crash-safe with commit mode preservation), startup dependency checks, safe ANSI color fallback via `c()` helper, and remote/local tag conflict checks.\n- ⚙️ **Configurable**: Per-repo `.commitgenrc` JSON config for default bump type, diff size, and model. Global config via `~/.commitgenrc`.\n- 🚀 **CI/CD Ready**: `--dry-run` and `--non-interactive` flags for headless/automated environments. Auto-detects CI environments (GitHub Actions, GitLab CI, Jenkins, Travis).\n- 🔍 **Commit Validation**: Validates commit messages against conventional commit format (72 char limit, proper format, blank line after title). Shows warnings in review screen for format violations and version tag collisions.\n- 📊 **Commit Statistics**: Shows detailed stats with per-extension file counts before committing.\n- 🔤 **Spell Checking**: Optional spell-check via system `aspell` command (press `s` in review screen).\n- 🛠️ **Interactive UI**:\n  - **Commit Mode Selection**: Choose between new commit, amend, or fresh amend at startup\n  - Stage, unstage (`u`), and proceed (`p`) with already-staged files using an iterative picker loop (preventing stack overflows and supporting pre-staged files)\n  - Review, edit (`e`), spell-check (`s`), or preview diffs (`d`) before committing\n  - Version bump options (`v`) only shown for new commits (amend mode skips version bump by default)\n  - Monitor CI pipelines live directly after pushing\n  - Validation warnings (including version tag collision warning) displayed in review screen\n  - **GitHub Repository Creation**: Interactively prompts to create a public/private GitHub repository if no remote is configured (requires `gh` CLI).\n  - **Continuous Session**: Prompts to restart upon success or error, providing a seamless multi-commit experience without abrupt termination.\n\n## Code Base\n\n```\ngit-commit/\n├── git_commit.py              ← main tool (1,667 lines)\n├── register.py                ← install/uninstall context menu (winreg)\n├── .env.template              ← copy to .env and add your API key\n├── .env                       ← local configuration (contains API key, gitignored)\n├── .gitignore                 ← ignores .env and Python cache\n├── git.ico                    ← Windows icon for context menu\n├── README.md                  ← setup and usage guide\n├── CODE_DOCUMENTATION.md      ← technical implementation details\n└── DESIGN_PHILOSOPHY.md       ← architecture decisions\n```\n\n## Setup\n\n1. Copy `.env.template` to `.env` in the same directory as `git_commit.py`:\n   ```bash\n   copy .env.template .env\n   ```\n2. Open `.env` and configure your `GEMINI_API_KEY`:\n   ```env\n   GEMINI_API_KEY=your_gemini_api_key_here\n   GEMINI_MODEL=gemini-3.1-flash-lite  # (optional, this is the default)\n   ```\n\n*Note: The script automatically resolves and loads the `.env` file from the directory where `git_commit.py` is installed/located, so you can execute the command from any folder. If a `.env` file is also present in the current working directory, it will load that as well to allow project-specific overrides.*\n\n## Usage\n\n```bash\npython git_commit.py              # normal interactive mode\npython git_commit.py --dry-run    # preview commit without making changes\npython git_commit.py --non-interactive  # headless/CI mode (no prompts)\n```\n\n**Command-line Options:**\n- `--dry-run`: Preview the commit message and actions without making any changes\n- `--non-interactive`: Run in headless mode (auto-stages all files, no prompts, uses defaults)\n\n**Auto-detection:** The tool automatically detects CI environments (GitHub Actions, GitLab CI, Jenkins, Travis) and enables non-interactive mode.\n\n### Options inside the tool:\n\n**Commit Mode Selection** (appears at startup if previous commits exist):\n- `n`: Create a NEW commit (default) - includes version bump and tag\n- `a`: AMEND the last commit - updates message and adds staged changes (no version bump)\n- `f`: FRESH amend - replaces last commit message completely with new AI suggestion (no version bump)\n\n**Staging**: Choose which files to stage (`a` = all, numbers, `u` to unstage, or `p` to proceed with just the staged files). Already-staged files shown in green.\n\n**Context**: Provide optional notes to steer the AI. You can also specify version in context (e.g., \"v1.2.3\") for auto-detection.\n\n**Review Screen**:\n- `c`: Execute the commit (or amend, depending on mode)\n- `e`: Manually edit the generated summary/description\n- `v`: Change version bump (`patch`, `minor`, `major`, `custom:X.Y.Z`, `none`) - **only shown for new commits**\n- `d`: View the full git diff in `less` (with `-R` for color support)\n- `s`: Run a spell-check via `aspell`\n- `x`: Cancel and exit\n\n**Post-Commit Actions**:\n- Push to remote (defaults to yes; includes automatic force push prompt for amended commits, or repository creation options if no remote exists)\n- Create Pull Request (if on a branch)\n- Monitor CI pipeline (if `gh` CLI is available)\n\n### Session Recovery\nIf the tool crashes or is interrupted after generating a commit message, it will automatically save the session state. On the next launch, you'll be prompted to resume the session, skipping the API call and saving time.\n\n**Session state includes:**\n- Commit mode (new/amend/fresh amend)\n- Generated summary and description\n- Version bump choice\n- Staged files list\n- Current version\n\n**Note:** Non-interactive mode automatically clears saved sessions to prevent stale state in CI environments.\n\n### Config File (`.commitgenrc`)\nCreate a `.commitgenrc` JSON file in your repo (or `~/.commitgenrc` globally) to set project defaults:\n```json\n{\n  \"default_bump\": \"minor\",\n  \"max_diff_length\": 20000,\n  \"auto_push\": false,\n  \"model\": \"gemini-3.1-flash-lite\",\n  \"auto_tag\": false\n}\n```\n\n**Configuration priority** (highest to lowest):\n1. Environment variables (e.g., `GEMINI_MODEL`)\n2. `.commitgenrc` (repo-local)\n3. `~/.commitgenrc` (global user config)\n4. Built-in defaults\n\n**Available options**:\n- `default_bump`: Default version bump type (`patch`, `minor`, `major`, `none`)\n- `max_diff_length`: Maximum diff size in characters (default: 20000)\n- `auto_push`: Automatically push after commit (default: false)\n- `model`: Gemini model to use (default: `gemini-3.1-flash-lite`)\n- `auto_tag`: Automatically create/move git tags without confirmation prompt (default: `false` for safety)\n\n## Windows Right-Click Context Menu Integration\n\nAdd a shortcut to Windows Explorer so you can right-click any folder and launch this tool directly — no `.reg` files needed.\n\n**Install** (run PowerShell/CMD as Administrator):\n```powershell\npython register.py --install\n```\n\n**Remove**:\n```powershell\npython register.py --uninstall\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishnakanthb13%2Fgit-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrishnakanthb13%2Fgit-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishnakanthb13%2Fgit-commit/lists"}