Skip to content

Commit 6a94283

Browse files
author
Your Name
committed
Automated commit on 2024-12-31 17:04:08
1 parent f7e59b2 commit 6a94283

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tools/automateGitPush.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ sudo chown -R $(whoami):$(whoami) *
2121
git add .
2222
git commit -m "$COMMIT_MESSAGE"
2323

24-
# Push changes to the remote repository
25-
git push
24+
# Attempt to push changes to the remote repository
25+
if ! git push; then
26+
echo "Push failed due to divergence. Attempting to resolve..."
27+
28+
# Pull remote changes and rebase
29+
if ! git pull --rebase; then
30+
echo "Rebase failed. Forcing the push to resolve divergence."
31+
git push --force
32+
else
33+
# Push changes after successful rebase
34+
git push
35+
fi
36+
fi
2637

2738
echo "Ownership changed, files committed, and changes pushed successfully!"

0 commit comments

Comments
 (0)