zoukankan      html  css  js  c++  java
  • Git fork代码同步更新

    背景: 在Gitee看到某个非常棒的项目, Fork到自己仓库, 同时git clone 自己仓库,用来自己开发,  后来初始Fork的项目更新了, 于是想更新初始Fork的最新代码和已改的代码整合起来..

    首先在本地查看remote源, 可以看见初始本地仓库副本的2个源

    PS E:workspace_ideaRuoYi-Vue> git remote -v
    origin  https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
    origin  https://gitee.com/easonstudy/RuoYi-Vue.git (push)

    此时新增原始Fork项目源, 然后再查看remote源

    PS E:workspace_ideaRuoYi-Vue> git remote add upstream https://gitee.com/y_project/RuoYi-Vue.git
    PS E:workspace_ideaRuoYi-Vue> git remote -v
    origin https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
    origin https://gitee.com/easonstudy/RuoYi-Vue.git (push)
    upstream https://gitee.com/y_project/RuoYi-Vue.git (fetch)
    upstream https://gitee.com/y_project/RuoYi-Vue.git (push)

    然后拉取upstream(Fork)代码,本地会有upstream/master分支

    PS E:workspace_ideaRuoYi-Vue> git fetch upstream
    From https://gitee.com/y_project/RuoYi-Vue
    * [new branch] master -> upstream/master

    切换到自己仓库master分支,并合并upstream/master

    PS E:workspace_ideaRuoYi-Vue> git branch
    * master
    PS E:workspace_ideaRuoYi-Vue> git checkout master
    Already on 'master'
    Your branch is ahead of 'origin/master' by 1 commit.
      (use "git push" to publish your local commits)
    PS E:workspace_ideaRuoYi-Vue> git merge upstream/master
    Already up to date.

    更新完后实现自己仓库和Fork项目在自己本地了

  • 相关阅读:
    转:中国菜刀用法
    转的:burp suite小例子
    [转]阿里前员工评马云
    Burp Suite使用教程
    C++实现按绩点排名
    C++排列对称串
    C++实现01串排序
    C++判断五位以内的对称素数
    C++12!配对
    C++列出完数
  • 原文地址:https://www.cnblogs.com/eason-d/p/12761340.html
Copyright © 2011-2022 走看看