Created
January 9, 2018 09:51
-
-
Save mirshko/01874db297e6c82dba607c009c89acb6 to your computer and use it in GitHub Desktop.
Bash script to update a git branch from master and then push it back to GitHub.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rebaseAndPush() { | |
BRANCH="$(git rev-parse --abbrev-ref HEAD)" | |
echo "\nWorking branch: $BRANCH" | |
echo "\nRebase branch?" | |
select yn in "Yes" "No"; do | |
case $yn in | |
Yes ) echo "\nUpdating $BRANCH from master" && git fetch origin && git rebase origin/master; break;; | |
No ) break;; | |
esac | |
done | |
echo "\nPush to Github?" | |
select yn in "Yes" "No"; do | |
case $yn in | |
Yes ) echo "\nPushing branch: $BRANCH to Github" && git push -f origin $BRANCH:$BRANCH; break;; | |
No ) break;; | |
esac | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment