Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gcascio/commet


https://github.com/gcascio/commet

Last synced: about 4 hours ago
JSON representation

Awesome Lists containing this project

README

        



Banner for Commet

## Intro

Commet creates commit messages using Ollama. There are plenty of tools out there that do this but I was looking for something that does not rely on a pre-commit hook or similar. Instead I wanted just an alternative CLI command to `git commit` which I can use across my projects and integrates into my current workflow.

## How it works

Commet does three things using your local git installation and Ollama:

1. Get the current diff of the staged files (e.g. `git diff --cached`)
2. Send the diff with a prompt asking for a commit message to Ollama
3. Commit the changes and opening the editor to potentially edit the message (`git commit -m -e`)

## Installation

### Homebrew Tap

`brew tap gcascio/commet`

`brew install commet`

### Manually

Download the pre-compiled binaries from the [releases page](https://github.com/gcascio/commet/releases) and copy them to the desired location.

### Requirements

1. Local git installation
2. Access to the ollama API (by default at http://localhost:11434) with a model of choice (default: mistral)

## Usage

`commet [flags]`

### Options

```
-a, --all Commit all changed files i.e. 'git commit -a'
-h, --help help for commet
--llm string URL to LLM API i.e. Ollama, defaults to: http://localhost:11434/api/chat
-m, --model string LLM model to be used, defaults to: mistral
```

### Configuration

For persistent configurations commet can be configured with a .commet.yaml file in the home directory. E.g.

```yaml
llm: https://mydomain.com
model: mistral
```

## Limitations

Commet works best with small to medium sized changes. Trying to generate a commit message for a large change over multiple files usually results in unsatisfying results. In these cases it is recommended to split the changes into multiple smaller commits.

## Acknowledgments

As a starting point, the prompt to create the commit messages is mostly taken from [opencommit](https://github.com/di-sukharev/opencommit).