Github is very nice place to collaborate with other programmers.
This post describe how you update to recent code from original project to your project forked from main project.
1. Fork
Fork can be done by press "fork" in github website of target project.
The fork copies current state of target project to your account.
Assume that you have an account "youraccount" and target project name is "targetproject".
If you fork the target project, you can clone the project by following
$ git clone https://github.com/youraccount/targetproject.gitActually, it was cloned by
$ git clone https://github.com/targetproject/targetproject.gitSo now you can modify the forked project whatever you want.
2. Update from original project
Sometimes original project maintainer adds some features to targetproject repository.
Update can be done as follows. First of all, add targetproject repository as a remote.
$ git remote add upstream http://github.com/targetproject/targetproject.gitThis will add original repository as a remote in current (forked) repository.
You can check current remote repository by following.
$ git remote -v
3. Retrieve updated code from upstream
$ git fetch upstream (This will download the code updated.)
$ git branch -va (This will shows available branches.)
4. Merge
First checkout master to make current branch to head of our forked project
$ git checkout masterThis will merge original head to our master.
$ git merge upstream/master
References
[1] https://help.github.com/articles/syncing-a-fork
[2] http://gun.io/blog/how-to-github-fork-branch-and-pull-request/
No comments:
Post a Comment