標籤:
github更新自己Fork的代碼時間 2014-03-02 23:25:55 micmiu - 軟體開發原文 http://www.micmiu.com/software/build/github-fork-update/主題 GitHub Git
github上有個功能叫fork,可以將別人的工程複製到自己帳號下。這個功能很方便,但其有一個缺點是:當源項目更新後,你fork的分支並不會一起更新,需要自己手動去更新。
以gitHub使用者:micmiu (帳號名),fork 項目 sql-parser(https://github.com/FoundationDB/sql-parser) 為例子:
1、clone 自己帳號裡fork的分支
git clone https://github.com/micmiu/sql-parser.gitcd sql-parser
2、增加遠程原始分支到本地(可以用 git remote -v 命令查看遠程分支列表)
$ git remote -voriginhttps://github.com/micmiu/sql-parser.git (fetch)originhttps://github.com/micmiu/sql-parser.git (push)
如果沒有遠程原始分支則需要增加:
git remote add sql-parser_fdb https://github.com/FoundationDB/sql-parser.git
查看確認遠程分支列表:
git remote -voriginhttps://github.com/micmiu/sql-parser.git (fetch)originhttps://github.com/micmiu/sql-parser.git (push)sql-parser_fdbhttps://github.com/FoundationDB/sql-parser.git (fetch)sql-parser_fdbhttps://github.com/FoundationDB/sql-parser.git (push)
3、fetch原始源分支的新版本到本地
git fetch sql-parser_fdb
4、合并兩個版本的代碼
git merge sql-parser_fdb/master
5、把最新的代碼提交到github自己(micmiu)的帳號上
git push origin master
—————– EOF @Michael Sun —————–
【轉】github更新自己Fork的代碼