Created
March 3, 2015 17:30
-
-
Save gabrielpoca/e7e9a1e438de215b6d59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
| current=`git branch | sed -n '\/* /s///p'` | |
| destiny=${1:-master} | |
| # 1. Update destiny | |
| git fetch | |
| git checkout $destiny | |
| [[ $? == 0 ]] || exit "failed to switch to $destiny" | |
| git rebase | |
| # 2. rebase PR branch | |
| git checkout $current | |
| git rebase $destiny | |
| [[ $? == 0 ]] || exit "failed to rebase from $destiny" | |
| git rebase -i $destiny | |
| # 3. merge | |
| git push -f | |
| git checkout $destiny | |
| git merge --ff-only $current | |
| git push | |
| # 4. remove branch | |
| git push origin :$current | |
| git branch -d $current |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment