Making Github’s “fork & pull” model palatable

When collaborating with other people using Github’s “fork & pull” collaboration model, it is a real PITA to have to re-fork and re-merge upstream repository changes all the time. The solution is to set your “forked” repository to use different pull (fetch) and push repositories. This way one can always pull/update from the upstream but keep pushing own changes (AND the upstream updates) to the forked repository of his own. This single, simple (when you know it and you know how to do it) step makes a major change in the efficiency and perception of the “fork & pull” collaboration model.

In case the original post disappears from the net – here is the extract (authorship and copyright of the original author duly acknowledged):

First of all you need to set the remotes url to the one of main repository (the one you forked from):

git remote set-url origin git://github.com/chief/global.git

Then you set the push url of that remote to your’s (forked) repo:

git remote set-url --push origin git@github.com:User/forked.git

Yeah, it’s weird that you can’t set the different pull url by itself, just a push one. Anyways, now we have our awesome remote config:

git remote -v
origin git://github.com/chief/global.git (fetch)
origin git@github.com:User/forked.git (push)
Advertisements
This entry was posted in Coding, Git and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s