蕲春人 - 软件开发

简单就是美.

How to Update a Forked Repository From Original Repository at Github?

If you use github, you can follow this.

I use huachlee/ruby-china repository for example.

At huacnlee/ruby-china repository homepage, clicked “Fork” button, then after serval minutes, you will have you own forked repository copy.Then you clone to local.

1
git clone git@github.com:qichunren/ruby-china.git

Then you commit your changes, and push to it.When you found the original repository has some updated feature,you can do as follow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd ruby-china
git remote add upstream git://github.com/huacnlee/ruby-china.git
caojinhua:ruby-china caojinhua$ git fetch upstream
remote: Counting objects: 345, done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 266 (delta 196), reused 156 (delta 98)
Receiving objects: 100% (266/266), 31.92 KiB | 25 KiB/s, done.
Resolving deltas: 100% (196/196), completed with 67 local objects.
From git://github.com/huacnlee/ruby-china
 * [new branch]      github_autocomplete -> upstream/github_autocomplete
 * [new branch]      markdown   -> upstream/markdown
 * [new branch]      master     -> upstream/master
 * [new branch]      post       -> upstream/post
caojinhua:ruby-china caojinhua$ git merge upstream/master

That is it.

Resources:

Comments