Presented by Krishna Prasad

About Us

What is our aim

Git remote ( git remote ) Command

This command usefull while you are working with multiple upstream i.e in case of fork and you want to do some changes in multiple person fork repository

You and your colleagues [e.g: allice, bob etc] working on a repository called project1, and bob has created a branch bug-1 in their fork report of project1 and changes have been completed in branch bug-1, just in case you want to change in bob branch bug-1, then you have to do the following steps before you can checkout bob branch bug-1.

1. You have already have to upstream i.e on for main repository i.e project1 and one for your fork reporsitory of project1, so the following command looks like:
$ git remote -v
origin https://github.com/krishnaiitd/swirl_courses.git (fetch) origin https://github.com/krishnaiitd/swirl_courses.git (push) upstream git@github.com:swirldev/swirl_courses.git (fetch) upstream git@github.com:swirldev/swirl_courses.git (push)

If not then please add the remote i.e main repo as in upstream source.

$ git remote add upstream 'git@github.com:swirldev/swirl_courses.git' And then check it again as git remote -v you will get it.

Now the problem here is add the bob branch in you local systeam, so that you can work on that branch i.e bug-1 of bob. It is simple, just add another upstream as bob-upstream in your remote

$ git remote add bob-upstream 'git@github.com:bobusername/swirl_courses.git'

After add this you can verify by above command $ git remote -v bob remote are visible. Now fetch the bobs branch as $ git fetch bob-upstream this commands will fetch the bobs all branch, now you can pull the bob's specific branch i.e bug-1 as $ git fetch bug-1 or $ git fetch bob-upstream/bug-1

Do what ever you want and then push to bob that branch as

$ git push bob-upstream bug-1

Read carfully above for the command git remote add to work with multiple fork branches.