Keep your git repository updated with a friend’s repository

This is the way I use to keep my repository in sync when working on a project together with a friend:

Clone your main project:

$ git clone

Add your friend repository:

$ git remote add yourfriend

Create a new branch to receive your friend modifications:

$ git branch develop
$ git checkout develop

Pull the commits from your friend repository:

$ git pull yourfriend master

Return to you master branch and merge modifications:

$ git checkout master
$ git merge develop

Send modifications to your repository:

$ git push origin master

Other alternative:

$ git remote add yourfriend

$ git fetch yourfriend

$ git rebase yourfriend/master

$ git push origin master

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s