【轉】github更新自己Fork的代碼

來源:互聯網
上載者:User

標籤:

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的代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.