Guest User

Untitled

a guest
Jul 17th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. # SHIP
  2.  
  3. #!/bin/bash
  4. TO_SHIP_TO=$1
  5. CURRENT=`git branch | grep '\*' | awk '{print $2}'`
  6. if [ -z $TO_SHIP_TO ]; then
  7. echo "First argument has to be one of these branches:"
  8. git branch | grep -v $CURRENT
  9. exit 1
  10. fi
  11. git rebase -i $TO_SHIP_TO
  12. REBASE_STATUS=$?
  13. if [[ "${REBASE_STATUS}" -ne 0 ]]; then
  14. echo "Rebase aborted"
  15. exit 0
  16. fi
  17. STATUS=`git checkout $TO_SHIP_TO | awk '{print $1}'`
  18. if [[ "${STATUS}" =~ error ]]; then
  19. echo "Something went terribly wrong! ${STATUS}"
  20. git checkout ${CURRENT}
  21. exit 1
  22. else
  23. git merge ${CURRENT} && \
  24. git push && \
  25. git checkout ${CURRENT} && \
  26. git rebase $TO_SHIP_TO
  27. fi
Add Comment
Please, Sign In to add comment