search

Home  >  Q&A  >  body text

git - fork后clone下来的项目如何保持与原项目同步?

例如,我两天前fork一个项目,今天clone我fork的项目到本地。发现昨天原项目已经更新了,如何保持本地的项目、我github上fork的项目与原项目同步?

过去多啦不再A梦过去多啦不再A梦2765 days ago1027

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:37:40

    Remotely pull update projects. First add the original package as remote to the local project:

    git remote add upstream A_REPOSITORY_URL

    Pull remote code

    git pull upstream master

    Finally commit to your own fork:

    git push origin master

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:37:40

    The correct answer upstairs is to usually update the master locally and then merge it into your own branch.

    reply
    0
  • Cancelreply