From 3e998a891103b434da4c7a2f6c48fb95289bdef1 Mon Sep 17 00:00:00 2001
From: MB <michael.blaschek@univie.ac.at>
Date: Fri, 23 Apr 2021 13:58:08 +0200
Subject: [PATCH] push choice

---
 Git/git-repos-sync | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
 mode change 100644 => 100755 Git/git-repos-sync

diff --git a/Git/git-repos-sync b/Git/git-repos-sync
old mode 100644
new mode 100755
index 10fb8e9..1969510
--- a/Git/git-repos-sync
+++ b/Git/git-repos-sync
@@ -38,7 +38,7 @@ fi
 if git checkout --quiet -b sync-$3 right/$3; then
 	echo "Merge branches from left and right if necessary."
 	if ! git merge -m "Merge to sync between $1 and $2" --log left/$3; then
-                >&2 echo "Merge conflict. Solve is manually, commit and rerun script."
+                >&2 echo "Merge conflict. Solve it manually, commit and rerun script."
                 exit 1
     fi
 else
@@ -46,29 +46,39 @@ else
 	git checkout --quiet sync-$3
 	echo "Try to merge with right first"
 	if ! git merge -m "Merge to sync between $1 and $2" --log right/$3; then
-                >&2 echo "Merge conflict. Solve is manually, commit and rerun script."
+                >&2 echo "Merge conflict. Solve it manually, commit and rerun script."
                 exit 1
     fi
 	if ! git merge -m "Merge to sync between $1 and $2" --log left/$3; then
-                >&2 echo "Merge conflict. Solve is manually, commit and rerun script."
+                >&2 echo "Merge conflict. Solve it manually, commit and rerun script."
                 exit 1
     fi
 fi
 
 echo "Push merged changes in $3 to $2"
-if ! git push $2 HEAD:$3; then
-	>&2 echo "Fatal: unable to push to $2, rerun the script as soon as connection restored."
-	exit 1
-
+read -p "[USER] continue (y/n)" REPLY
+# echo "REPLY: $REPLY"
+if [ "$REPLY" == "y" ]; then
+	if ! git push $2 HEAD:$3; then
+		>&2 echo "Fatal: unable to push to $2, rerun the script as soon as connection restored."
+		exit 1
+	fi
+else
+	echo "Abort not pushed to $2"
 fi	
-echo "Push merged changes in $3 to $1"
-if ! git push $1 HEAD:$3; then
-	>&2 echo "Fatal: unable to push to $1, rerun the script as soon as connection restored."
-	exit 1
 
+echo "Push merged changes in $3 to $1"
+read -p "[USER] continue (y/n)" REPLY
+# echo "REPLY: $REPLY"
+if [ "$REPLY" == "y" ]; then
+	if ! git push $1 HEAD:$3; then
+		>&2 echo "Fatal: unable to push to $1, rerun the script as soon as connection restored."
+		exit 1
+	fi
+else
+	echo "Abort not pushed to $1"
 fi	
 
 git checkout --quiet master
 git branch -D --quiet sync-$3
-
 echo "Done."
-- 
GitLab