Skip to content

Instantly share code, notes, and snippets.

@JesseHerrick
Created April 5, 2014 03:25
Show Gist options
  • Save JesseHerrick/9987105 to your computer and use it in GitHub Desktop.
Save JesseHerrick/9987105 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
git remote add upstream $1
git pull origin HEAD # make sure it's recent
git fetch upstream HEAD # fetch origin's fork changes
git merge upstream/HEAD &>/dev/null || git rebase upstream/master # apply changes
git rebase HEAD # keep HEAD at the top
git push origin HEAD # push changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment