Github上更新自己fork的代碼

來源:互聯網
上載者:User
一、前提

本文的前提是你已經在github上fork了別人的分支,並且弄好了跟github的ssh串連。
相關配置詳情參考:https://help.github.com

二、詳細操作
  1. 檢出自己在github上fork別人的分支到rrest目錄下,其中rrest目錄之前是不存在的。
    git clone git@github.com:yss/rrestjs.git rrest
  2. 然後增加遠程分支(也就是你fork那個人的分支)名為bob(這個名字任意)到你本地。
    git remote add bob https://github.com/DoubleSpout/rrestjs.git
    如果你運行命令:git remote -v你會發現多出來了一個Bob的遠程分支。如下:

    bob https://github.com/DoubleSpout/rrestjs.git (fetch)bob https://github.com/DoubleSpout/rrestjs.git (push)origin git@github.com:yss/rrestjs.git (fetch)origin git@github.com:yss/rrestjs.git (push)
  3. 然後,把對方的代碼拉到你本地。
    git fetch bob
  4. 最後,合并對方的代碼。
    git merge bob/master
  5. 最最後,把最新的程式碼推送到你的github上。
    git push origin master

這樣就完成了自己的代碼更新。

三、後話

此文目的在於記錄自己使用github的經驗,如果你也使用github的話,希望對你有協助。謝謝~。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.