autocommit.webm
AutoCommit is a handy command-line tool that simplifies the git commit process by automatically generating meaningful commit messages using AI. Leveraging OpenAI's powerful language model, AutoCommit takes into account the changes made to the codebase and produces concise, descriptive commit messages that reflect the purpose and nature of those changes.
Git commits are an integral part of the software development process. However, crafting meaningful commit messages can sometimes be a time-consuming and even a daunting task. AutoCommit is designed to ease this process and help developers maintain a clean commit history without the overhead of thinking about commit messages for each and every change.
PS: Commits from this repository were generated using AutoCommit 🤖
- AI-Powered Commit Messages: AutoCommit uses OpenAI's language model to generate commit messages that are concise and meaningful.
- Interactive CLI: The tool comes with an interactive command-line interface that guides you through the commit process.
- Customizable: Customize the level of verbosity and other settings to suit your preferences.
- Clipboard Integration: Easily copy generated commit messages to the clipboard.
- Completion Scripts: AutoCommit comes with completion scripts for Bash, Zsh, Fish, and PowerShell.
-
Clone the repository:
git clone https://github.com/christian-gama/autocommit.git cd autocommit
-
Build the application (Make sure you have Go installed):
make build
-
Install the application (Linux/macOS):
make install
-
Add completion to your shell (Optional):
Fish:
autocommit completion fish > ~/.config/fish/completions/autocommit.fish exec fish
Bash:
autocommit completion bash | sudo tee /etc/bash_completion.d/autocommit > /dev/null exec bash
Zsh:
mkdir -p ~/.zsh/completions autocommit completion zsh > ~/.zsh/completions/_autocommit echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc echo 'autoload -Uz compinit && compinit' >> ~/.zshrc source ~/.zshrc
PowerShell:
autocommit completion powershell > autocommit.ps1 # Then source autocommit.ps1 in your PowerShell profile
AutoCommit uses OpenAI's API for generating commit messages, so you'll need to have an API key from OpenAI. You can get one by signing up on OpenAI's website.
Once you have your API key, run the autocommit
command. On the first run, AutoCommit will ask you for your OpenAI API key, preferred language model, and other settings. These settings will be stored locally on your machine for future use.
- Change to your git repository.
- Make the changes in your repository that you want to commit.
- Stage the changes.
- Run the AutoCommit tool:
Autocommit is a CLI tool that uses OpenAI's models to generate commit messages based on the changes made in the repository. Usage: autocommit [flags] autocommit [command] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command reset Reset the configuration file set Set configuration configs Flags: -h, --help help for autocommit Use "autocommit [command] --help" for more information about a command.
- Follow the interactive command-line interface. Choose whether to commit changes to git, generate a new commit message, copy the commit message to the clipboard, or exit the tool.
- If you select the commit option, the tool will use the generated message to make a git commit.
AutoCommit provides you with a unique command called autocommit edit
that allows you to customize the default instructions given to the AI. With this feature, you can tailor AutoCommit's behavior to better match your workflow and style.
Simply run autocommit edit
in your terminal to open up the current instruction set in your default text editor.
autocommit edit
After making your changes, save and exit the editor. AutoCommit will now use your updated instructions when generating commit messages. This allows you to adjust the level of detail, tone, and style of the generated commit messages.
Please note that if the instruction file is deleted or found to be empty, AutoCommit will automatically recreate it with the default instructions.
AutoCommit generates commit messages that follow the Conventional Commits specification. It is a good practice to make small, incremental commits that are easy to understand and follow. If you're trying to make a commit that contains multiple changes, consider splitting it into multiple commits - it will make your commit history much cleaner and helps the AI generate better commit messages.
- The tool currently only supports english generated messages.
- Sometimes the tool ignores some instructions (gpt-3.5 model).
- Commits with a lot of changes may produce a meaningless commit message.
AutoCommit is released under the MIT License.