Skip to content

Commit

Permalink
feat: Update README with new script download instruction.
Browse files Browse the repository at this point in the history
  • Loading branch information
wajeht committed Jul 12, 2024
1 parent 1a847ae commit 11c9285
Showing 1 changed file with 4 additions and 30 deletions.
34 changes: 4 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,13 @@ Generate conventional commits using `OpenAI` based on `git diff`

# 📖 Documentation

You must have `jq`, `git`, and `curl` installed in your system.
1. You must have `jq`, `git`, `wget`, and `curl` installed in your system.

Save the follow script as `commit.sh` and give it executable permission `chmod +x ./commit.sh`
2. Download `commit` script via `wget http://localhost/commit.sh`.

```bash
#!/bin/bash

git add -A

message=$(git --no-pager diff --cached | jq -Rs '{"diff": .}' | curl -s -X POST "http://localhost" -H "Content-Type: application/json" -d @- | jq -r '.message')

if [ -z "$message" ]; then
echo "Aborting commit due to empty commit message."
exit 1
else
echo "$message"
read -p "Do you want to use this commit message? (y/n, Enter for yes): " confirm
if [ -z "$confirm" ] || [ "$confirm" = "y" ]; then
git commit -m "$message" --no-verify
else
read -p "Enter custom commit message: " custom_message
if [ -z "$custom_message" ]; then
echo "Aborting commit due to empty custom commit message."
exit 1
else
git commit -m "$custom_message" --no-verify
fi
fi
fi

```
3. Save the follow script as `commit.sh` and give it executable permission `chmod +x ./commit.sh`

Now just run `./commit.sh` inside a `git` folder after any changes in version control.
4. Now just run `./commit.sh` inside a `git` folder after any changes in version control.

# 💻 Development

Expand Down

0 comments on commit 11c9285

Please sign in to comment.