Category: GIT

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 git.yourproject.com/projectname.get

Add your friend repository:

$ git remote add yourfriend git.yourfriend.com/hisprojectname.git

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.yourfriend.com/hisprojectname.git

$ git fetch yourfriend

$ git rebase yourfriend/master

$ git push origin master
Advertisements