git fetch
git pull
git commit
git push
Automated script to commit:
#!/bin/bashssh qspcadmin@USAZLINUXQSPCQ01 << EOFcd /stage/qspcadmin/projects/sasgit fetchgit pullgit add .git commit -m "Automated Commit"git pushEOF
Automated bashrc function to commit with good message:
function gpt_commit() {
diff=$(git diff)
response=$(curl -s -X POST https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are an assistant that writes concise and informative git commit messages based on the provided git diff."
},
{
"role": "user",
"content": "$diff"
}
],
"temperature": 0.3
}
EOF
)
commit_message=$(echo "$response" | grep '"content":' | cut -d '"' -f 4)
echo "Generated commit message: $commit_message"
git commit -m "$commit_message"
}
No comments:
Post a Comment