summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/commit.sh23
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