From c8b6ea53392c42e40b1bb63031a90ab1ecca71c2 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Tue, 17 Sep 2024 01:35:52 +0100 Subject: [PATCH] Enhance README and update commit message hook logic (#19) * Please set the OPENAI_API_KEY environment variable. Update readme * Fix check --- .githooks/prepare-commit-msg | 2 +- README.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index c8df175..a14bbf3 100644 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -3,7 +3,7 @@ LC_ALL=C COMMIT_MSG_FILE=$1 -if [[ -z "$COMMIT_MSG_FILE" ]]; then +if [[ -n "$COMMIT_MSG_FILE" ]]; then exit 0 fi diff --git a/README.md b/README.md index 84e8484..d056e6a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ # ![GIT Hooks + OpenAI - Generate GIT commit messages from Open AI](docs/images/splash.png) 🧠 🧰 This tool generates AI-powered commit messages via Git hooks, automating meaningful message suggestions from OpenAI and others to improve commit quality and efficiency. + +--- + +## What does I do + +Generates a commit message based on `git diff` result using the [OpenAI](https://platform.openai.com/docs/overview) API. + +--- + +## Getting started + +```ps +dotnet tool install -g AiCommitMessage +cd my-project/ +dotnet-aicommitmessage install-hook +``` + +1. Install the tool globally. +2. Move to the project folder. +3. Install the Git hook on the default `hooks` directory. + +---