-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitWS
executable file
·32 lines (25 loc) · 849 Bytes
/
gitWS
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
# Set the repository URL and local path
REPO_URL="[email protected]:praveenraj-rs/WS.git"
LOCAL_PATH="$HOME/WS"
# Check if the local repository exists and is a git repository
if [ ! -d "$LOCAL_PATH" ]; then
echo "Repository does not exist locally. Cloning..."
git clone "$REPO_URL" "$LOCAL_PATH"
fi
# Navigate to the repository
cd "$LOCAL_PATH" || exit
# Check for changes in the repository
if [ -n "$(git status --porcelain)" ]; then
echo "Changes detected. Staging and committing..."
# Add all changes to the staging area
git add .
# Get the current date in the format date_month_year
current_date=$(date +"%d_%m_%Y")
# Commit with the current date as the message
git commit -m "$current_date"
# Push the changes to the remote repository
git push
else
echo "No changes detected."
fi