github.com/loafoe/cli@v7.1.0+incompatible/bin/push.sh (about) 1 #!/usr/bin/env bash 2 set -e 3 4 git pull -r 5 6 branch_name=$(git rev-parse --abbrev-ref HEAD) 7 if [[ "$branch_name" == "master" ]]; then 8 printf "It looks like you are committing to master. If this is something that needs to be backported, please make the commit there and then use this script to merge it forward.\n Do you want to continue? [y/N]:" 9 10 read input 11 if [[ "$input" == "y" || "$input" == "Y" ]]; then 12 git push 13 fi 14 exit 0 15 fi 16 17 git push 18 printf "Do you want to merge this commit forward to master? [y/N]: " 19 20 read input 21 if [[ "$input" == "y" || "$input" == "Y" ]]; then 22 git rebase origin/master 23 git checkout master 24 git pull -r 25 git merge $branch_name 26 make clean && make build 27 git push 28 29 git checkout $branch_name 30 git reset origin/$branch_name --hard 31 fi