diff options
Diffstat (limited to 'scripts/commit.sh')
| -rw-r--r-- | scripts/commit.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/commit.sh b/scripts/commit.sh new file mode 100644 index 0000000..50ce5fa --- /dev/null +++ b/scripts/commit.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +if git diff --cached --quiet; then + echo "No staged changes." + exit 1 +fi + +MSG=$(git diff --cached | ollama run git-commit) + +echo +echo "Generated commit message:" +echo "$MSG" +echo + +read -p "Commit? [Y/n] " CONFIRM + +if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then + exit 0 +fi + +git commit -m "$MSG"
\ No newline at end of file |
