Skip to content

Instantly share code, notes, and snippets.

@brianc
Created March 27, 2015 13:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianc/32d2835d6f752a65b1b8 to your computer and use it in GitHub Desktop.
Save brianc/32d2835d6f752a65b1b8 to your computer and use it in GitHub Desktop.
#!/bin/bash
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git fetch
git rebase origin/master
git rebase -i HEAD~`git log origin/master.. --pretty=oneline | wc -l | sed -e 's/^[ \t]*//'`
git push origin $branch --force
git checkout master
git pull
git merge $branch
git log master ^origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment