We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7e59b2 commit 6a94283Copy full SHA for 6a94283
tools/automateGitPush.sh
@@ -21,7 +21,18 @@ sudo chown -R $(whoami):$(whoami) *
21
git add .
22
git commit -m "$COMMIT_MESSAGE"
23
24
-# Push changes to the remote repository
25
-git push
+# Attempt to push changes to the remote repository
+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
37
38
echo "Ownership changed, files committed, and changes pushed successfully!"
0 commit comments