Skip to content

Instantly share code, notes, and snippets.

@ebridges
Created April 21, 2015 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebridges/96ff29bf8a106da15fac to your computer and use it in GitHub Desktop.
Save ebridges/96ff29bf8a106da15fac to your computer and use it in GitHub Desktop.
How to rebase master onto a long-lived branch that has been pushed to origin already
## 0.
$ BRANCH_NAME=eqb/my-branch
## 1. Pull down latest remote version of master & branch
$ git checkout master && git pull
$ git checkout $BRANCH_NAME && git pull
## 2. Delete remote branch
$ git push origin --delete $BRANCH_NAME
## 3. Remove dangling reference to origin
$ git branch --unset-upstream
## 4. Apply changes from master on branch
$ git rebase master
## 5. (optional) Push branch back to origin
$ git push origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment