Skip to content

Instantly share code, notes, and snippets.

@yeungegs
Last active April 18, 2017 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yeungegs/b18019dbf0466a523b0521bae405b066 to your computer and use it in GitHub Desktop.
Save yeungegs/b18019dbf0466a523b0521bae405b066 to your computer and use it in GitHub Desktop.
sync forked shellfish to master

Before you proceed, ensure that you have already forked a copy of shellfish and cloned your fork to your computer.

Change working directory to shellfish

% cd
% cd shellfish

List the current configured remote repository for your fork.

% git remote -v                                                                                                               
origin  https://github.com/YOUR_USERNAME/shellfish.git (fetch)
origin  https://github.com/YOUR_USERNAME/shellfish.git (push)

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

% git remote add upstream https://github.com/glyif/shellfish.git

Verify the new upstream repository you've specified for your fork.

% git remote -v
origin  https://github.com/yeungegs/shellfish.git (fetch)
origin  https://github.com/yeungegs/shellfish.git (push)
upstream        https://github.com/glyif/shellfish.git (fetch)
upstream        https://github.com/glyif/shellfish.git (push)

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                                                                                                           
From https://github.com/glyif/shellfish
 * [new branch]      edit/readme-style -> upstream/edit/readme-style
 * [new branch]      master     -> upstream/master

Check out your fork's local master branch.

% git checkout master
Switched to branch 'master'

Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.

% git merge upstream/master
Already up-to-date

If the original repository owners have made changes, this will fast forward and show all the changes that take place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment