Last Updated: February 25, 2016
·
377
· bryanmikaelian

Sync forks with main repo

Contributing to an open source project? Here what I have been using to keep my fork in sync with the main repo (in this example, I am using the Rails repo):

$ git remote add upstream git://github.com/rails/rails.git

$ git fetch upstream

$ git rebase upstream/master

Boom. Your fork is now in sync with the main repo.

For a faster workflow, you can alias some of these commands in your gitconfig. For example:

[alias]
railsync = fetch upstream && rebase upstream/master