This small Go application helps you generate concise and meaningful git commit messages using Azure OpenAI hosted models.
- Generates commit messages based on the staged changes (git diff).
- Prepends the formatted branch name (if it starts with "feature/") to the commit message.
- Allows you to use an existing commit message if it's not empty.
- Go installed and configured.
- Git installed and configured.
azoaiGo package installed:go get github.com/mhingston/azoai- Git hook for
prepare-commit-msg(.git/hooks/prepare-commit-msg) - Environment variables set:
AZURE_OPENAI_API_KEY: Your Azure OpenAI API key.AZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint.AZURE_OPENAI_API_VERSION: The API version for the Azure OpenAI service.AZURE_OPENAI_API_DEPLOYMENT: The deployment name for the model.
- Clone the repository:
git clone https://github.com/mhingston/commit-message-generator.git - Build the application:
go build main.go
- Stage your changes using
git add. - The git hook will trigger the application e.g.
commit-message-generator .git/COMMIT_EDITMSG - The application will generate a commit message based on the staged changes.