-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·32 lines (25 loc) · 826 Bytes
/
push.sh
File metadata and controls
executable file
·32 lines (25 loc) · 826 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
#!/bin/bash
# Ensure a commit message is provided
if [ -z "$1" ]; then
echo "Error: Commit message is required as the first argument."
echo "Usage: ./push.sh \"Your commit message\""
exit 1
fi
# Set the desired author email
NEW_AUTHOR_EMAIL="dyarkovs@student.42wolfsburg.de"
# Ensure git is installed
if ! command -v git &> /dev/null; then
echo "Error: Git is not installed. Please install it and try again."
exit 1
fi
# Add changes to staging
echo "Adding changes to staging..."
git add .
# Commit with the specified author email
echo "Committing with author email: $NEW_AUTHOR_EMAIL"
GIT_AUTHOR_EMAIL="$NEW_AUTHOR_EMAIL" git commit -m "$1"
# Push changes
echo "Pushing changes to the repository..."
git push
# Confirmation message
echo "Done! Changes have been pushed with author email: $NEW_AUTHOR_EMAIL."