Skip to content

Instantly share code, notes, and snippets.

@acamino
Last active February 29, 2016 21:59
Show Gist options
  • Save acamino/42abe9946a5734cf469a to your computer and use it in GitHub Desktop.
Save acamino/42abe9946a5734cf469a to your computer and use it in GitHub Desktop.
Working with forks

Working with Forks

List remotes repositories.

git remote -v

Add a new remote upstream repository that will be synced with the fork.

git remote add upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

We'll update upstream remote.

git remote set-url upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

###Syncing a fork

Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.

git fetch upstream

Merge the changes from upstream/master into your local master branch.

git merge upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment