Archived
19 lines
526 B
Bash
Executable File
19 lines
526 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
git add -A
|
|
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
if command -v llm &>/dev/null; then
|
|
COMMIT_MSG=$(git diff --staged | awk 'BEGIN{print "根据代码变更生成一个 git commit,尽量简洁不废话,如果有正文需要符合标题+空行+正文的规范。只返回结果"}1' | llm)
|
|
git commit -m "$(echo "$COMMIT_MSG" | head -n1)" -m "$(echo "$COMMIT_MSG" | tail -n +3)"
|
|
else
|
|
git commit -m "auto commit at $(date '+%Y-%m-%d %H:%M:%S')"
|
|
fi
|
|
|
|
git push
|