Sunday, May 5, 2013

Updating forked repository with parent repository, Github

Suppose you have a team working on a repository name "Base" and a particular team member wants to work on specific module. He forks the Base repository to his account. Later he needs to get latest changes done by developers on Base repository to his repository. Here are the steps to follow:

a) In Github, you name repositories like 'origin', 'remote' etc. Add Base repository as remote to your repo.
git remote add teambranch git://
Here teambranch is the name of remote and you can get the git link info from the base repo web ui.

b) Use git fetch to download objects and ref from another repository
git fetch teambranch
It will fetch all branches of remote into remote-tracking branches.

c) Rewrite your master branch
git rebase teambranch/master
And your repository will be updated.

I am still learning Git and will post more helpful post as come across. Also I read couple of post to achieve this merging task but still don't have complete understanding on working of  various git commands. Will keep on posting as I will learn.

No comments:

Post a Comment