To install the tool using go install
, run the following command:
go install github.com/komapotter/go-git-aico/cmd/git-aico@latest
This will install the git-aico
executable in your $GOPATH/bin
directory.
- Ensure you have staged changes in your git repository by running
git add
. - Run the tool using
git aico
to generate commit message suggestions. - If you want verbose output, which includes the raw response from OpenAI, run the tool with the
-v
flag like this:git aico -v
. - The tool will present you with a list of commit message suggestions based on the staged changes.
- Select the appropriate commit message by entering the number corresponding to the suggestion.
- The tool will automatically commit your staged changes with the selected commit message.
To use this tool, you need to set the following environment variables:
OPENAI_API_KEY
: Your OpenAI API keyNUM_CANDIDATES
: The number of commit message candidates to generate (default: 3)OPENAI_MODEL
: The OpenAI model to use (default: gpt-4o)OPENAI_TEMPERATURE
: The OpenAI temperature parameter (default: 0.1)OPENAI_MAX_TOKENS
: The maximum number of tokens for OpenAI (default: 450)
Example of setting environment variables:
export OPENAI_API_KEY="your_openai_api_key"
export NUM_CANDIDATES=3
export OPENAI_MODEL="gpt-4o"
export OPENAI_TEMPERATURE=0.1
export OPENAI_MAX_TOKENS=450