-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-automation.sh
More file actions
executable file
·52 lines (42 loc) · 1.34 KB
/
git-automation.sh
File metadata and controls
executable file
·52 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Git Automation Script with Cursor AI
# Automates common git workflows with AI assistance
#
# NOTE: This is a conceptual workflow example. Cursor is an editor application,
# not a CLI tool. Adapt this workflow to use Cursor's Chat (Cmd/Ctrl + L)
# or Composer (Cmd/Ctrl + I) features. See ../../CURSOR-USAGE-NOTE.md
#
# Reference: https://cursor.com/docs/
set -e
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
CHANGED_FILES=$(git diff --name-only HEAD)
echo "Current branch: $BRANCH_NAME"
echo "Changed files: $CHANGED_FILES"
# Stage all changes
echo "Staging changes..."
git add .
# Generate commit message using Cursor AI
echo "Generating commit message with AI..."
echo ""
echo "Use Cursor Chat (Cmd/Ctrl + L) to generate commit message:"
echo " Prompt: 'generate a clear, concise git commit message for these changes: $CHANGED_FILES'"
echo ""
read -p "Enter the commit message from Cursor: " COMMIT_MSG
echo "Generated commit message: $COMMIT_MSG"
# Ask for confirmation
read -p "Commit with this message? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git commit -m "$COMMIT_MSG"
echo "Changes committed successfully"
else
echo "Commit cancelled"
exit 1
fi
# Optionally push to remote
read -p "Push to remote? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git push origin "$BRANCH_NAME"
echo "Pushed to remote"
fi