GitHub更新自己Fork的項目


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

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.git
cd sql-parser

2、增加遠程原始分支到本地(可以用 git remote -v 命令查看遠程分支列表)

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

如果沒有遠程原始分支則需要增加:

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

查看確認遠程分支列表:

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)

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

git fetch sql-parser_fdb

4、合並兩個版本的代碼

git merge sql-parser_fdb/master

5、把最新的代碼提交到github自己(micmiu)的賬號上

git push origin master


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM