{"id":20956136,"url":"https://github.com/the-cafe/git-ai-commit","last_synced_at":"2025-05-14T04:33:58.540Z","repository":{"id":252353184,"uuid":"837741401","full_name":"the-cafe/git-ai-commit","owner":"the-cafe","description":"let AI write your commit messages","archived":false,"fork":false,"pushed_at":"2025-03-22T02:55:54.000Z","size":19300,"stargazers_count":66,"open_issues_count":6,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-22T22:09:32.004Z","etag":null,"topics":["ai","cli","githook","llms","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/git-ai-commit/","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/the-cafe.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}},"created_at":"2024-08-03T22:12:48.000Z","updated_at":"2025-04-15T05:57:43.000Z","dependencies_parsed_at":"2024-08-11T04:09:26.561Z","dependency_job_id":"06e35327-f117-4d0b-b0e4-8d9db44c512f","html_url":"https://github.com/the-cafe/git-ai-commit","commit_stats":null,"previous_names":["ming1in/ai-commit-msg","the-cafe/ai-commit-msg"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-cafe%2Fgit-ai-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-cafe%2Fgit-ai-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-cafe%2Fgit-ai-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-cafe%2Fgit-ai-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-cafe","download_url":"https://codeload.github.com/the-cafe/git-ai-commit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254071446,"owners_count":22009792,"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":["ai","cli","githook","llms","python"],"created_at":"2024-11-19T01:24:24.992Z","updated_at":"2025-05-14T04:33:56.903Z","avatar_url":"https://github.com/the-cafe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 `git-ai-commit`\n\n\u003ca href=\"https://pypi.org/project/git-ai-commit\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/git-ai-commit\" alt=\"Current version\"\u003e\u003c/a\u003e\n![PyPI - Downloads](https://img.shields.io/pypi/dm/git-ai-commit)\n\nTl;DR\n\n- AI that writes your commit messages.\n\n- A CLI and git hook that summarizes your changes every time you run `git commit`.\n\n- Integrates with the [`pre-commit`](https://pre-commit.com/) framework, working alongside all your git hooks.\n\n## 📺 Usage\n\n![Usage Demo](assets/videos/ai-commit-msg.gif)\n\n`git-ai-commit` currently support the following LLM providers...\n\n- **Open AI**: `gpt-4o-mini`(default), `gpt-4`, `gpt-3.5`, and [more...](https://github.com/ming1in/ai-commit-msg/blob/a1e62be64c1f877bfa26c45d2d61508f94504ec0/ai_commit_msg/utils/models.py#L1)\n\n- **Anthropic**: `claude-3-haiku`, `claude-3-sonnet`, `claude-3-opus`\n  - [Wiki: Setup Anthropic Model](./wiki/anthropic.md)\n\n- **Local Ollama**: `llama3`, `mistral`, `phi-3`, `gemma`, and [more..](https://github.com/ming1in/ai-commit-msg/blob/a1e62be64c1f877bfa26c45d2d61508f94504ec0/ai_commit_msg/utils/models.py#L1)\n  - [Wiki: Using local Ollama LLM model](./wiki/ollama.md)\n\n## 🚀 Getting Started\n\n1. Install the `git-ai-commit` tool via pip\n\n```bash\npip install git-ai-commit\n\ngit-ai-commit --version # verify installation\n```\n\n2. Start configuring your tool\n\n```bash\ngit-ai-commit config --setup\n```\n\n3. Your done, happy committing! Check out our fun range of command, the LLM can even help you, just run...\n\n```bash\ngit-ai-commit help-ai [question?]\n\n# or get help the ol fashion way\n\ngit-ai-commit --help\n```\n\n## ⚡️ Quick Start: Setup Git Hook\n\nTo quickly setup your [`prepare-commit-msg`](\u003chttps://git-scm.com/docs/githooks#_prepare_commit_msg\u003e) git hook, execute the command below.\n\nCaution, this will override any existing `prepare-commit-msg` hooks you may have. To coordinate multiple git hook, check out the [`pre-commit`](https://pre-commit.com/) framework.\n\n```bash\ngit-ai-commit hook --setup\n```\n\nThat is all, your good to go! Now every time you run `git commit`, let AI present you with a commit message.\n\n## 🪝 Integrate with `pre-commit` framework\n\n`git-ai-commit` integrates easily with your other git hook using the `pre-commit` framework. Follow the instructions below to get set up.\n\n1. Install the [`pre-commit`](https://pre-commit.com/) git hooks framework\n\n```bash\nbrew install pre-commit\npre-commit --version \n```\n\n2. Create a `.pre-commit-config.yaml` files and add the following config.\n\n```bash\ntouch .pre-commit-config.yaml \n```\n\n```yaml\n# .pre-commit-config.yaml \n\ndefault_install_hook_types: \n  # make sure you include `prepare-commit-msg` in `default_install_hook_types`\n  - prepare-commit-msg\nrepos:\n  - repo: https://github.com/the-cafe/git-ai-commit\n    rev: v1.0.9\n    hooks:\n    -   id: git-ai-commit\n```\n\n3. Based on the config above, install your `pre-commit` hook scripts.\n\n```bash\npre-commit install \n```\n\n4. Setup your OpenAI key, [see their docs for help](https://platform.openai.com/docs/quickstart).\n\n```bash\ngit-ai-commit config --openai-key=...\n```\n\n## 🛠️ CLI Commands \u0026 Options\n\n✨ `git-ai-commit  config`\n\nDisplay your current config settings. Option flags can be used to configure various settings in your configuration. For example...\n\n```bash\ngit-ai-commit config\n\ngit-ai-commit config --openai-key=... --model=gpt-4o-mini\n```\n  \n- `-k` `--openai-key`\n\n  Set or update the OpenAI API key to access their GPT models.\n\n- `-a` `--anthropic-key`\n\n  Set or update the Anthropic API key to access their Claude models.\n\n- `-m` `--model`\n\n  *default:  \"gpt-4o-mini\"*\n\n  Select a model to power our tool from our supported provider. To use a [Ollama](./wiki/ollama.md) model, prefix `ollama/\u003cmodel\u003e`.\n\n- `-ou` `--ollama-url`\n\n  *default:  \"\u003chttp://localhost:11434/api/chat\u003e\"*\n\n  Set the URL for interacting with your local Ollama models.\n\n- `-s` `--setup`\n\n  Config your git hook, model, and API keys via the NUX flow.\n\n- `-l` `--logger`\n\n  *default:  false*\n\n  A toggle for enabling logs that are saved to a local file - `.git/ai_commit_message.log`. This was intended to be used as a local debug tool.\n\n- `-r` `--reset`\n\n  Resets your entire config settings to the default state. This will reset all settings, including API keys and model.\n\n- `-p` `--prefix`\n\n  Set a prefix for the generate commit messages.\n\n- `-ml` `--max-length`\n\n  Set the character limit for the LLM response. In our testing, the greater the limit the more details are included in the commit messages.\n\n---\n\n🔎 `git-ai-commit summarize`\n\nGet a quick summary of your local changes\n\n```bash\ngit-ai-commit summarize\n```\n\n- `-u` `--unstaged`\n\n  Summarize your local *unstaged* changes.\n\n- `-d` `--diff`\n\n  Provide a .diff file from the local file system to summarize\n\n---\n\n📌 `git-ai-commit  help`, `-h`\n\nDisplays a list of available command and options to help you setup our tool.\n\n```bash\ngit-ai-commit help # -h\n```\n\n---\n🪝 `git-ai-commit hook`\n\nManage and setup `git-ai-commit` as a [`prepare-commit-msg`](\u003chttps://git-scm.com/docs/githooks#_prepare_commit_msg\u003e) git hook.\n\n```bash\ngit-ai-commit hook --setup\n```\n\n- `-s` `--setup`\n\n  Adds a git hook by generating a `.git/hooks/prepare-commit-msg` script in your git repo.\n\n- `-sh` `--setup-husky`\n\n  Integrate our hook into your [husky git hooks](https://typicode.github.io/husky/) by generating a `.husky/prepare-commit-msg` script in your git repo.\n\n- `-r` `--remove`\n\n  Removes the git hook.\n\n- `-x` `--run`\n\n  Executes the custom logic for our git hook. This option was intended to only run from the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) git hook.\n\n## 🤝 Wanna Contribute?\n\nDo you love our tool and wanna support us? Drop us a star 🌟\n\nHave some feedback on what we could do better? [Create a issue](https://github.com/the-cafe/git-ai-commit/issues/new) we'll respond in 24hrs we promise 😄\n\nWanna contribute code and improve our product, check out our\n[Local Development Wiki](./wiki/local_development.md) to get started.\n\nRight now we're focused on\n\n- Improving our prompting strategy to generate the best commit message possible\n\n- Super charge our CLI to support broad developer use cases and build the best interface we can\n\n- Build some tests\n\n## 🎉 Fun Facts\n\n- In this repository, every commit prefixed with `✨` was generated by AI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-cafe%2Fgit-ai-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-cafe%2Fgit-ai-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-cafe%2Fgit-ai-commit/lists"}