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