{"id":21445489,"url":"https://github.com/shinchven/git-gpt","last_synced_at":"2025-05-09T00:06:49.377Z","repository":{"id":214571470,"uuid":"707633914","full_name":"ShinChven/git-gpt","owner":"ShinChven","description":"A CLI tool to generate insightful commit messages and issues with GPT model.","archived":false,"fork":false,"pushed_at":"2025-05-03T12:02:56.000Z","size":139,"stargazers_count":61,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-09T00:06:37.550Z","etag":null,"topics":["cli","git","gpt","prompt-engineering"],"latest_commit_sha":null,"homepage":"","language":"Python","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/ShinChven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-10-20T10:18:20.000Z","updated_at":"2025-05-03T12:02:59.000Z","dependencies_parsed_at":"2025-05-03T12:19:02.485Z","dependency_job_id":"c8234705-c466-4c8b-9617-eb55ab829a63","html_url":"https://github.com/ShinChven/git-gpt","commit_stats":null,"previous_names":["shinchven/git-gpt"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinChven%2Fgit-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinChven%2Fgit-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinChven%2Fgit-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinChven%2Fgit-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShinChven","download_url":"https://codeload.github.com/ShinChven/git-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166518,"owners_count":21864476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","gpt","prompt-engineering"],"created_at":"2024-11-23T02:35:04.038Z","updated_at":"2025-05-09T00:06:49.323Z","avatar_url":"https://github.com/ShinChven.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git-GPT\n\nGit-GPT is a versatile CLI tool designed to auto-generate git commit messages, issues, and perform various code quality checks using multiple AI providers. It supports OpenAI, Azure OpenAI, Ollama, Claude, and Google Generative AI, giving you the flexibility to choose the best model for your needs.\n\n![generate-commit-message](/assets/generate-commit-message.webp)\n\n## Installation\n\nInstall `git-gpt` via pip:\n\n```bash\npip install git+https://github.com/ShinChven/git-gpt.git\n```\n\nUpgrade:\n\n```bash\npip install --upgrade git+https://github.com/ShinChven/git-gpt.git\n```\n\n## Development\n\nTo set up the development environment:\n\n```bash\ngit clone https://github.com/ShinChven/git-gpt.git\ncd git-gpt\npython -m venv venv\nsource venv/bin/activate\npip install -e .\n```\n\n### Project Structure\n\nThe project is organized as follows:\n\n- `git_gpt/main.py`: The main entry point of the CLI application.\n- `git_gpt/__init__.py`: Initializes the package and defines the version.\n- `git_gpt/config_command.py`: Handles the configuration command.\n- `git_gpt/commit_command.py`: Implements the commit message generation.\n- `git_gpt/issue_command.py`: Manages the issue creation functionality.\n- `git_gpt/quality_command.py`: Performs quality checks on code changes.\n- `git_gpt/changelog_command.py`: Generates changelogs based on commits.\n- `git_gpt/ask_command.py`: Allows asking custom questions about code diffs.\n- `git_gpt/ai_client.py`: Handles API requests to multiple AI providers.\n\nEach command is implemented in its own file for better organization and maintainability.\n\n## Configuration\n\nBefore using `git-gpt`, you'll need to configure it with your API settings. For a step-by-step guided configuration, use the following command:\n\n```bash\ngit-gpt config\n```\n\nThis command will prompt you for each configuration setting, making the process easier and more user-friendly.\n\nTo configure a new model or update an existing one using a single command (all options are mandatory):\n\n```bash\ngit-gpt config --alias MODEL_ALIAS --model_name MODEL_NAME --provider PROVIDER --key API_KEY --api_base API_BASE\n```\n\n- `--alias`: A unique name for the model configuration\n- `--model_name`: The name of the model (e.g., \"gpt-4\" for OpenAI, \"claude-3-sonnet-20240229\" for Claude, \"gemini-1.5-pro\" for Google Generative AI)\n- `--provider`: The provider of the model (e.g., \"openai\", \"azure-openai\", \"ollama\", \"claude\", or \"google-generativeai\")\n- `--key`: The API key (optional, depending on the provider)\n- `--api_base`: The API base URL (optional, defaults to https://api.anthropic.com for Claude)\n\nIf you don't provide all options using the single command method, you'll be prompted to enter the missing information.\n\n### Setting the Default Model\n\nTo set the default model:\n\n```bash\ngit-gpt set-default MODEL_ALIAS\n```\n\n### Deleting a Model Configuration\n\nTo delete a model configuration:\n\n```bash\ngit-gpt delete-model MODEL_ALIAS\n```\n\n### Showing All Configured Models\n\nTo display all configured models with their provider and masked API key:\n\n```bash\ngit-gpt show-models\n```\n\n## Supported AI Providers\n\nGit-GPT supports multiple AI providers, allowing you to choose the one that best fits your needs. The supported providers are:\n\n1. **OpenAI**: Use models like GPT-3 and GPT-4.\n2. **Azure OpenAI**: Access OpenAI models through Microsoft's Azure platform.\n3. **Ollama**: An open-source, locally hosted language model.\n4. **Claude (Anthropic)**: Use models like Claude-3.\n5. **Google Generative AI**: Access models like Gemini.\n\nEach provider may have specific requirements for model names and API configurations. When configuring a new model, make sure to use the correct provider name and follow any provider-specific instructions.\n\n## Ollama Support\n\nGit-GPT now supports Ollama, an open-source, locally hosted language model. This allows you to use Git-GPT without relying on external API services.\n\n### Setting up Ollama:\n\n1. Install and set up Ollama on your local machine (visit [Ollama's website](https://ollama.ai/) for instructions).\n2. Pull the desired model(s) using Ollama's CLI (e.g., `ollama pull gemma2`).\n\n### Configuring Git-GPT for Ollama:\n\nTo use Ollama with Git-GPT, configure it as follows:\n\n```bash\ngit-gpt config --api-type ollama --ollama-base http://localhost:11434 --model \u003cMODEL_NAME\u003e\n```\n\nReplace `\u003cMODEL_NAME\u003e` with the model you've pulled in Ollama (e.g., llama2, codellama, mistral, etc.).\n\n### Default Model:\n\nThe default model for Ollama in Git-GPT is set to 'gpt-4o-mini'. You can change this by specifying a different model during configuration or when running commands.\n\n### Using Ollama:\n\nOnce configured, you can use Git-GPT with Ollama just like you would with OpenAI. All commands (commit, issue, quality, changelog, ask) will automatically use your Ollama configuration.\n\nNote: When using Ollama, you don't need to provide an API key.\n\n## Usage\n\n### Generating Commit Messages\n\nStage all changes and generate a commit message:\n\n```bash\ngit-gpt commit [--lang \u003cLANGUAGE\u003e] [--model \u003cMODEL\u003e] [--run-dry]\n```\n\nOptions:\n\n- `--lang`: Target language for the generated message (default is 'en').\n- `--model`: The model to use for generating messages (default is set in config).\n- `--run-dry`: Print the generated message without committing.\n\n### Creating Issues\n\nTo create an issue based on the diffs of the latest commit(s), run:\n\n```bash\ngit-gpt issue [--lang \u003cLANGUAGE\u003e] [--model \u003cMODEL\u003e] [--max-tokens \u003cMAX_TOKENS\u003e] [--commit-range \u003cCOMMIT_RANGE\u003e]\n```\n\nOptions:\n\n- `--lang`: Target language for the generated message (default is 'en').\n- `--model`: The model to use for generating messages (default is set in config).\n- `--max-tokens`: The maximum number of tokens to use for the issue prompt (overrides the configured value).\n- `--commit-range`: The range of commits to consider for generating the issue.\n\n### Performing a Quality Check\n\nTo perform a quality check on the diffs of the latest commit(s), run:\n\n```bash\ngit-gpt quality [--lang \u003cLANGUAGE\u003e] [--model \u003cMODEL\u003e] [--max-tokens \u003cMAX_TOKENS\u003e] [--commit-range \u003cCOMMIT_RANGE\u003e]\n```\n\nOptions:\n\n- `--lang`: Target language for the generated message (default is 'en').\n- `--model`: The model to use for generating messages (default is set in config).\n- `--max-tokens`: The maximum number of tokens to use for the quality check prompt (overrides the configured value).\n- `--commit-range`: The range of commits to consider for the quality check.\n\n### Generating a Changelog\n\nTo generate a changelog based on the diffs of the latest commit(s), run:\n\n```bash\ngit-gpt changelog [--lang \u003cLANGUAGE\u003e] [--model \u003cMODEL\u003e] [--max-tokens \u003cMAX_TOKENS\u003e] [--commit-range \u003cCOMMIT_RANGE\u003e]\n```\n\nOptions:\n\n- `--lang`: Target language for the generated changelog (default is 'en').\n- `--model`: The model to use for generating the changelog (default is set in config).\n- `--max-tokens`: The maximum number of tokens to use for the changelog prompt (overrides the configured value).\n- `--commit-range`: The range of commits to consider for generating the changelog.\n\n### Asking a Custom Question\n\nTo ask a custom question about the code diffs, run:\n\n```bash\ngit-gpt ask --question \u003cYOUR_QUESTION\u003e [--model \u003cMODEL\u003e] [--commit-range \u003cCOMMIT_RANGE\u003e]\n```\n\nOptions:\n\n- `--question`: The question to ask about the code diffs.\n- `--model`: The model to use for generating the response (default is set in config).\n- `--commit-range`: The range of commits to consider when forming the response.\n\n## Trouble Shooting\n\n### aiohttp\n\nIf you encounter any issues concerning `aiohttp`, please try to downgrade python to 3.11, as this issue is reported with python 3.12:\n\n```log\nERROR: Could not build wheels for aiohttp, which is required to install pyproject.toml-based projects\n```\n\n## Disclaimer\n\n- Content generated by this tool is not guaranteed to be correct. You should always review and edit the generated content before committing.\n\n## Contributing\n\nFeel free to fork the repository, create a feature branch, and open a Pull Request.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinchven%2Fgit-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinchven%2Fgit-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinchven%2Fgit-gpt/lists"}