GitHub更新本身Fork的項目

轉自:http://www.tuicool.com/articles/MzMJre git

github的fork能夠將別人的工程複製到本身帳號下。這個功能很方便,但其有一個缺點是:當源項目更新後,你fork的分支並不會一塊兒更新,須要本身手動去更新。 github

以gitHub用戶:micmiu (帳號名),fork 項目 sql-parser(https://github.com/FoundationDB/sql-parser) 爲例子: sql

一、clone 本身帳號裏fork的分支fetch

git clone https://github.com/micmiu/sql-parser.git
cd sql-parser

二、增長遠程原始分支到本地(能夠用 git remote -v 命令查看遠程分支列表)ui

$ git remote -v
origin  https://github.com/micmiu/sql-parser.git (fetch)
origin  https://github.com/micmiu/sql-parser.git (push)

若是沒有遠程原始分支則須要增長:code

git remote add sql-parser_fdb https://github.com/FoundationDB/sql-parser.git

查看確認遠程分支列表:rem

git remote -v
origin  https://github.com/micmiu/sql-parser.git (fetch)
origin  https://github.com/micmiu/sql-parser.git (push)
sql-parser_fdb  https://github.com/FoundationDB/sql-parser.git (fetch)
sql-parser_fdb  https://github.com/FoundationDB/sql-parser.git (push)

三、fetch原始源分支的新版本到本地get

git fetch sql-parser_fdb

四、合併兩個版本的代碼it

git merge sql-parser_fdb/master

五、把最新的代碼提交到github本身(micmiu)的帳號上io

git push origin master
相關文章
相關標籤/搜索