Skip to content
Snippets Groups Projects
Commit 3e998a89 authored by Michael Blaschek's avatar Michael Blaschek :bicyclist:
Browse files

push choice

parent f257f49b
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ fi ...@@ -38,7 +38,7 @@ fi
if git checkout --quiet -b sync-$3 right/$3; then if git checkout --quiet -b sync-$3 right/$3; then
echo "Merge branches from left and right if necessary." echo "Merge branches from left and right if necessary."
if ! git merge -m "Merge to sync between $1 and $2" --log left/$3; then 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 exit 1
fi fi
else else
...@@ -46,29 +46,39 @@ else ...@@ -46,29 +46,39 @@ else
git checkout --quiet sync-$3 git checkout --quiet sync-$3
echo "Try to merge with right first" echo "Try to merge with right first"
if ! git merge -m "Merge to sync between $1 and $2" --log right/$3; then 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 exit 1
fi fi
if ! git merge -m "Merge to sync between $1 and $2" --log left/$3; then 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 exit 1
fi fi
fi fi
echo "Push merged changes in $3 to $2" echo "Push merged changes in $3 to $2"
if ! git push $2 HEAD:$3; then read -p "[USER] continue (y/n)" REPLY
>&2 echo "Fatal: unable to push to $2, rerun the script as soon as connection restored." # echo "REPLY: $REPLY"
exit 1 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 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 fi
git checkout --quiet master git checkout --quiet master
git branch -D --quiet sync-$3 git branch -D --quiet sync-$3
echo "Done." echo "Done."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment