[refer to ]http://www.haojii.com/2011/08/how-to-git-merge-from-forked-repository/]
問題是這樣的,github裡有個項目ruby-gmail,我需要從fork自同一個項目的另一個repository拿一些Bug Fix的代碼
link1:https://github.com/dcparker/ruby-gmail (原作者dcparker的repository)
link2:https://github.com/jihao/ruby-gmail (我從link1 fork的repository)
link3:https://github.com/geoffyoungs/ruby-gmail (geoffyoungs 從link1 fork的repository,然後他有些Bug修改,但是沒被merge回原作者的link1的repository)
也就我git clone repository到本地後,發現link3有我想要的代碼,我要把link3上的改動merge到我的repository上,避免我花精力改相同的bug
git如何merge github forked repository裡的更新?
具體做法是下面三步,以前沒用git這麼搞過,知道之後其實蠻簡單
1. >git remote add geoffyoungs http://github.com/geoffyoungs/ruby-gmail.git
2. >git fetch geoffyoungs
3. >git merge geoffyoungs/master
>git remote -v
geoffyoungs http://github.com/geoffyoungs/ruby-gmail.git (fetch)
geoffyoungs http://github.com/geoffyoungs/ruby-gmail.git (push)
origin http://[email protected]/jihao/ruby-gmail.git (fetch)
origin http://[email protected]/jihao/ruby-gmail.git (push)
>git branch -a
* master
remotes/geoffyoungs/gh-pages
remotes/geoffyoungs/master
remotes/origin/HEAD -> origin/master
remotes/origin/adimircolen-master
remotes/origin/gh-pages
remotes/origin/master