Created
November 4, 2014 14:45
-
-
Save damonp/8608e5396a7c627ddd37 to your computer and use it in GitHub Desktop.
Git script to rebase local branch to remote master
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
#!/bin/bash | |
if [ "$1" = "" ]; then | |
echo Current branch name required | |
exit; | |
fi | |
if [ "$2" = "stash" ]; then | |
echo "Stashing current state..." | |
git stash | |
fi | |
git checkout master | |
git pull | |
echo | |
read -p ">Continue with: git rebase master $1?" | |
git rebase master $1 | |
echo | |
read -p ">Continue with: git rebase $1 master?" | |
git rebase $1 master | |
echo | |
read -p ">Continue with: git pull origin master?" | |
git pull origin master | |
echo | |
read -p ">Continue with: git push origin master?" | |
git push origin master | |
echo | |
read -p ">Continue with: checkout $1?" | |
git checkout $1 | |
git status | |
if [ "$2" = "stash" ]; then | |
echo "Popping last stash..." | |
git stash pop | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment