diff --git a/Git/git-repos-sync b/Git/git-repos-sync old mode 100644 new mode 100755 index 10fb8e944bdd5aac60fd22d5af7d04f44b2ce0fb..19695106a628ba63b61bb8d1e88452f1eb12be7e --- 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."