-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·40 lines (31 loc) · 785 Bytes
/
push.sh
File metadata and controls
executable file
·40 lines (31 loc) · 785 Bytes
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
#!/bin/bash
# Script to stage, commit, and push changes to GitHub
# Check if there are any changes to commit
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit."
exit 0
fi
# Show what will be committed
echo "Changes to be committed:"
git status --short
echo ""
# Get commit message
if [ -z "$1" ]; then
echo "Enter commit message (or press Enter for default):"
read -r commit_message
if [ -z "$commit_message" ]; then
commit_message="Update code"
fi
else
commit_message="$1"
fi
# Stage all changes
echo "Staging changes..."
git add .
# Commit with message
echo "Committing changes..."
git commit -m "$commit_message"
# Push to GitHub
echo "Pushing to GitHub..."
git push
echo "Done! Changes have been pushed to GitHub."