{"id":48292632,"url":"https://github.com/andev0x/gitmit","last_synced_at":"2026-04-04T23:15:28.614Z","repository":{"id":308148649,"uuid":"1031776128","full_name":"andev0x/gitmit","owner":"andev0x","description":"A lightweight CLI tool that analyzes your staged changes and suggests professional commit messages following the Conventional Commits format — without relying on AI.","archived":false,"fork":false,"pushed_at":"2026-01-15T19:44:54.000Z","size":1012,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-15T20:50:40.455Z","etag":null,"topics":["cli","git","gitcommit","gitmit","go","open-source","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andev0x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"andev0x","custom":["https://www.buymeacoffee.com/anvndev"]}},"created_at":"2025-08-04T10:07:57.000Z","updated_at":"2026-01-15T19:04:35.000Z","dependencies_parsed_at":"2025-08-04T14:49:22.610Z","dependency_job_id":null,"html_url":"https://github.com/andev0x/gitmit","commit_stats":null,"previous_names":["andev0x/gitmit"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/andev0x/gitmit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andev0x%2Fgitmit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andev0x%2Fgitmit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andev0x%2Fgitmit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andev0x%2Fgitmit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andev0x","download_url":"https://codeload.github.com/andev0x/gitmit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andev0x%2Fgitmit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31418289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","git","gitcommit","gitmit","go","open-source","terminal"],"created_at":"2026-04-04T23:15:27.877Z","updated_at":"2026-04-04T23:15:28.595Z","avatar_url":"https://github.com/andev0x.png","language":"Go","funding_links":["https://github.com/sponsors/andev0x","https://www.buymeacoffee.com/anvndev"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/p1.png\" alt=\"Gitmit\" width=\"600\"/\u003e\n\n  [![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat\u0026logo=go)](https://golang.org)\n  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n  [![Go Report Card](https://goreportcard.com/badge/github.com/andev0x/gitmit)](https://goreportcard.com/report/github.com/andev0x/gitmit)\n\u003c/div\u003e\n\n# Gitmit\n\nA lightweight CLI tool that analyzes your staged changes and generates professional git commit messages following the [Conventional Commits](https://www.conventionalcommits.org/) specification.\n\n## Features\n\n- **Intelligent Analysis** - Analyzes git status and diff to understand your changes using advanced pattern detection\n- **Conventional Commits** - Follows the Conventional Commits specification for standardized messages\n- **Configuration Hierarchy** - Local (`.gitmit.json`) → Global (`~/.gitmit.json`) → Default (Embedded) config support\n- **Automatic Project Profiling** - Detects project type (Go, Node.js, Python, Java, etc.) from characteristic files\n- **Keyword Scoring Algorithm** - Analyzes git diff content and scores keywords to determine the best commit type\n- **Symbol Extraction** - Uses language-aware regex to extract function, class, and variable names\n- **Git Porcelain Status** - Leverages `git status --porcelain` for accurate file state detection\n- **Diff Stat Analysis** - Infers intent based on added vs deleted lines ratio\n- **Commit History Context** - Maintains consistency by learning from recent commit messages\n- **Interactive Mode** - Enhanced interactive prompts with y/n/e/r options (yes/no/edit/regenerate)\n- **Smart Regeneration** - Generate alternative commit messages with diverse suggestions\n- **Context-Aware Scoring** - Weighted algorithm for intelligent template selection\n- **Pattern Detection** - Detects error handling, tests, API changes, database operations, and more\n- **Multiple Commit Types** - Supports feat, fix, refactor, chore, test, docs, style, perf, ci, build, security, and more\n- **Zero Configuration** - Works out of the box with sensible defaults\n- **Offline First** - Complete offline operation, no AI or external dependencies required\n- **History Tracking** - Learns from your commit history to avoid repetitive suggestions\n\n\n## Installation\n\n### From Releases\n\nDownload the latest release for your platform from the [releases page](https://github.com/andev0x/gitmit/releases).\n\n### Build from Source\n\nClone the repository and build:\n\n```bash\ngit clone https://github.com/andev0x/gitmit.git\ncd gitmit\ngo build -o gitmit\n```\n\nOr with build confirmation:\n\n```bash\ngo build -o bin/gitmit 2\u003e\u00261 \u0026\u0026 echo \"✓ Build successful\" \u0026\u0026 ./bin/gitmit --version\n```\n\n### Installation to PATH\n\n#### Linux\n\n```bash\nsudo mv gitmit /usr/local/bin\n```\n\n#### macOS\n\nFirst, determine your Go binary directory:\n\n```bash\nwhich go\n```\n\nThen move the executable to your Go bin directory:\n\n```bash\nsudo mv bin/gitmit $(go env GOPATH)/bin/gitmit\n```\n\nAlternatively, add the directory containing `gitmit` to your shell's `PATH` environment variable.\n\n\n## Quick Start\n\nStage your changes and generate a commit message:\n\n```bash\ngit add .\ngitmit\n```\n\nGitmit will analyze your changes and suggest a professional commit message following Conventional Commits format.\n\n## Usage\n\n### Interactive Mode (Default)\n\nWhen you run `gitmit`, it will analyze your changes and present you with an interactive prompt:\n\n```bash\ngit add .\ngitmit\n\n💡 Suggested commit message:\nfeat(api): implement user authentication strategy\n\nActions:\n  y - Accept and commit\n  n - Reject and exit\n  e - Edit message manually\n  r - Regenerate different suggestion\n\nChoice [y/n/e/r]:\n```\n\n**Interactive Options:**\n- **`y`** (or press Enter) - Accept the suggestion and commit\n- **`n`** - Reject and exit without committing\n- **`e`** - Edit the message manually with your own text\n- **`r`** - Regenerate a completely different suggestion using intelligent variation algorithms\n\n### Command-Line Options\n\n```bash\n# Show suggested message without committing\ngitmit --dry-run\n\n# Get multiple ranked suggestions\ngitmit --suggestions\n\n# Show analysis context (what was detected)\ngitmit --context\n\n# Auto-commit with best suggestion (skip interactive)\ngitmit --auto\n\n# Enable debug mode\ngitmit --debug\n```\n\n### Subcommands\n\n#### Initialize Configuration\n\n```bash\n# Create local .gitmit.json in current directory\ngitmit init\n\n# Create global ~/.gitmit.json in home directory\ngitmit init --global\n```\n\nThe `init` command automatically detects your project type and generates a configuration file with:\n- Language-specific keyword mappings\n- Project-appropriate topic mappings\n- Customizable keyword scoring weights\n- Diff stat analysis thresholds\n\nSee [CONFIGURATION.md](CONFIGURATION.md) for detailed configuration options.\n\n#### Propose (Default Command)\n\n```bash\ngitmit propose           # Analyze and suggest commit message\ngitmit propose -i        # Interactive mode with multiple suggestions\ngitmit propose -s        # Show multiple ranked suggestions\ngitmit propose --context # Show what was analyzed\ngitmit propose --auto    # Auto-commit with best suggestion\n```\n\nIf no subcommand is provided, `gitmit` defaults to `propose`.\n\n## How It Works\n\nGitmit uses intelligent offline algorithms to analyze your changes:\n\n1. **Automatic Project Profiling** - Detects project type by checking for:\n   - `go.mod` (Go)\n   - `package.json` (Node.js)\n   - `requirements.txt` (Python)\n   - And more (Java, Ruby, Rust, PHP)\n\n2. **Git Porcelain Status** - Uses `git status --porcelain` to read file states:\n   - A (Added) → prioritizes `feat` templates\n   - M (Modified) → analyzes for `fix`, `refactor`, or `feat`\n   - D (Deleted) → suggests `chore` or `refactor`\n   - R (Renamed) → suggests `refactor`\n\n3. **Keyword Scoring Algorithm** - Analyzes `git diff --cached` content:\n   - Counts keyword occurrences\n   - Multiplies by configured weights\n   - Selects action with highest score\n   - Example: `+ func` (weight: 3) + `+ class` (weight: 2) = 5 points for `feat`\n\n4. **Symbol Extraction via Regex** - Language-aware pattern matching:\n   - Go: Functions (`func Name(`), structs (`type Name struct`)\n   - JavaScript: Functions, arrow functions, classes\n   - Python: Functions (`def name(`), classes (`class Name`)\n   - Fills `{item}` placeholder automatically\n\n5. **Path-based Topic Detection** - Uses `filepath.Dir` logic:\n   - Custom topic mappings from config\n   - Prioritizes `internal/` or `pkg/` subdirectories\n   - Falls back to most specific directory name\n\n6. **Diff Stat Analysis** - Analyzes line change ratios:\n   - Deleted lines \u003e 70% → suggests `refactor` (cleanup)\n   - Added lines \u003e 70% with 50+ lines → suggests `feat` (new feature)\n   - Balanced changes → suggests `refactor` (modification)\n\n7. **Commit History Context** - Maintains consistency:\n   - Retrieves most recent commit message\n   - Extracts scope from `type(scope): message` format\n   - Prioritizes same scope for next commit\n\n8. **Pattern Detection** - Identifies code patterns like:\n   - Error handling improvements\n   - Test additions\n   - API/endpoint changes\n   - Database operations\n   - Security enhancements\n   - Performance optimizations\n   - Configuration updates\n   - And 15+ other patterns\n\n9. **Context Analysis** - Examines:\n   - File types and extensions\n   - Directory structure\n   - Function/struct/method changes\n   - Line additions and deletions\n   - Multi-file patterns\n\n10. **Weighted Scoring** - Selects templates using:\n    - Placeholder availability (item, purpose, topic)\n    - Pattern matching bonuses\n    - File type context\n    - Special case detection\n    - Diversity algorithms for variations\n\n## Commit Types\n\nGitmit supports the following commit types (automatically detected):\n\n| Type | Description |\n|------|-------------|\n| **feat** | New features |\n| **fix** | Bug fixes |\n| **refactor** | Code refactoring |\n| **chore** | Maintenance tasks |\n| **test** | Adding or updating tests |\n| **docs** | Documentation changes |\n| **style** | Code style changes (formatting, whitespace) |\n| **perf** | Performance improvements |\n| **ci** | CI/CD configuration changes |\n| **build** | Build system changes |\n| **security** | Security improvements |\n| **config** | Configuration changes |\n| **deploy** | Deployment changes |\n| **revert** | Reverting previous commits |\n| **wip** | Work in progress |\n\n## Examples\n\n### Basic Interactive Usage\n\n```bash\n# Stage your changes\ngit add internal/api/handler.go\n\n# Run gitmit\ngitmit\n\n# Output:\n💡 Suggested commit message:\nfeat(api): implement authentication middleware\n\nActions:\n  y - Accept and commit\n  n - Reject and exit\n  e - Edit message manually\n  r - Regenerate different suggestion\n\nChoice [y/n/e/r]: r\n\n# After pressing 'r':\n💡 Alternative suggestion #1:\nfeat(api): add role-based access control for authentication\n\nChoice [y/n/e/r]: y\n\n✅ Changes committed successfully.\n```\n\n### Multiple Suggestions Mode\n\n```bash\ngit add .\ngitmit propose -s\n\n# Output:\n💡 Ranked Suggestions:\n1. feat(api): implement user authentication strategy (recommended)\n2. feat(api): add token-based access via middleware\n3. feat(auth): integrate OAuth provider for secure access\n4. feat(api): expose new endpoint for authentication\n5. feat(auth): implement MFA/2FA support for security\n```\n\n### Context Analysis\n\n```bash\ngitmit propose --context\n\n# Output:\n📊 Analysis Context:\nAction: feat\nTopic:  api\nItem:   handler\nPurpose: authentication\nScope:  auth\nFiles:  +127 -15\nTypes:  [go]\n\n💡 Suggested commit message:\nfeat(auth): implement handler authentication strategy\n```\n\n### Edit Mode\n\n```bash\ngitmit\n\n# Output:\n💡 Suggested commit message:\nfeat(api): add new endpoint\n\nChoice [y/n/e/r]: e\n\n📝 Edit the commit message:\nCurrent: feat(api): add new endpoint\nNew message: feat(api): add user registration endpoint with validation\n\n✓ Updated commit message:\nfeat(api): add user registration endpoint with validation\n\nChoice [y/n/e/r]: y\n✅ Changes committed successfully.\n```\n\n## Configuration\n\nGitmit works out of the box without any configuration, but you can customize its behavior using a configuration file.\n\n### Configuration Hierarchy\n\n1. **Local** (`.gitmit.json`) - Project-specific settings in current directory\n2. **Global** (`~/.gitmit.json`) - User-wide settings in home directory\n3. **Default** (Embedded) - Built-in defaults\n\nSettings from higher priority configs override lower priority ones.\n\n### Quick Start\n\n```bash\n# Create local config with auto-detected project type\ngitmit init\n\n# Create global config\ngitmit init --global\n```\n\nThe `init` command automatically:\n- Detects your project type (Go, Node.js, Python, etc.)\n- Generates language-specific keyword mappings\n- Creates customizable topic mappings\n- Sets up keyword scoring weights\n\n### Configuration Options\n\n**Core Features:**\n- **Project Type Detection** - Automatically identifies language/framework\n- **Keyword Scoring** - Define action-specific keywords and weights\n- **Topic Mappings** - Map file paths to commit scopes\n- **Diff Stat Threshold** - Control added/deleted line ratio analysis\n- **Custom Templates** - Define your own commit message patterns (coming soon)\n\n**Example `.gitmit.json`:**\n```json\n{\n  \"projectType\": \"go\",\n  \"diffStatThreshold\": 0.5,\n  \"topicMappings\": {\n    \"internal/api\": \"api\",\n    \"internal/database\": \"db\"\n  },\n  \"keywords\": {\n    \"feat\": {\n      \"func\": 3,\n      \"class\": 2\n    },\n    \"fix\": {\n      \"bug\": 3,\n      \"error\": 2\n    }\n  }\n}\n```\n\nFor detailed configuration documentation, see [CONFIGURATION.md](CONFIGURATION.md).\n\n### Intelligence Built-In\n\nAll intelligence is built-in using:\n\n- **Template-based generation** with 100+ curated commit message templates\n- **Pattern matching algorithms** for context detection\n- **Weighted scoring system** for template selection\n- **Similarity detection** for diverse variations\n- **Commit history tracking** to avoid repetition\n- **Language-aware symbol extraction** via regex\n- **Keyword scoring** based on git diff analysis\n- **Diff stat analysis** for intent inference\n\nNo AI, APIs, or external services required. Everything runs locally and offline.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Roadmap\n\n- [ ] Git hooks integration\n- [ ] Team commit templates\n- [ ] Commit message validation\n- [ ] Integration with issue trackers\n- [ ] Multi-language support\n- [ ] Commit message templates\n- [ ] Branch-based suggestions\n- [ ] Commit message history learning\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandev0x%2Fgitmit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandev0x%2Fgitmit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandev0x%2Fgitmit/lists"}