zoukankan      html  css  js  c++  java
  • Git Fork别人的代码后如同步别人的代码

    在git上fork别人的代码后,如果别人代码有更新,自己fork的代码是不能自动更新的。需要手动操作。

    git remote -v 查看是否有远程分支的别名。例如:git remote -v 后显示如下,只有自己fork的路径。需要手动添加。

    origin https://github.com/bill1208/incubator-carbondata (fetch)
    origin https://github.com/bill1208/incubator-carbondata (push)

    git remote add upstream https://github.com/apache/incubator-carbondata  此地址为别人远程分支的代码。

    再次运行git remote -v

    origin https://github.com/bill1208/incubator-carbondata (fetch)
    origin https://github.com/bill1208/incubator-carbondata (push)
    upstream https://github.com/apache/incubator-carbondata (fetch)
    upstream https://github.com/apache/incubator-carbondata (push)

    运行git fetch upstream下载远程分支的代码

    运行git checkout master 切换到本地master分支

    运行git merge upstream/master 合并upstream到master。 注意此时只合并了本地的分支,自己fork的远程分支代码没有变化。需要push

    运行git push

  • 相关阅读:
    三大范式
    html 横线的代码
    CSS下拉 菜单3.27第一次
    JS页面三种打开方式及对话框
    函数整理
    3.22整理作业
    for循环,if 练习
    php测试题
    设计模式
    面向对象的三大特性
  • 原文地址:https://www.cnblogs.com/nurseryboy/p/5874019.html
Copyright © 2011-2022 走看看