Skip to content

Instantly share code, notes, and snippets.

@jessesquires
Created April 3, 2016 04:38
Show Gist options
  • Save jessesquires/96b11a061ea2ce046940cb8db1294beb to your computer and use it in GitHub Desktop.
Save jessesquires/96b11a061ea2ce046940cb8db1294beb to your computer and use it in GitHub Desktop.

Revisions

  1. Natthan revised this gist Apr 2, 2016. No changes.
  2. Natthan created this gist Apr 2, 2016.
    3 changes: 3 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    > [Does anyone have a script to sync their forked #swiftlang repos with upstream? So: pull upstream github/apple/* then push origin github/me/* - @jesse_squires](https://twitter.com/jesse_squires/status/716374725044211714)
    Reference: [Syncing a fork - User Documentation](https://help.github.com/articles/syncing-a-fork/)
    12 changes: 12 additions & 0 deletions sync-local-upstream.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # Assumes that the git repository has upstream and remote urls set
    # Assumes that you've committed your work on your current branch

    current_branch=$(git rev-parse --abbrev-ref HEAD)

    git fetch upstream
    git checkout master
    git merge upstream/master

    git push # origin

    git checkout $current_branch