zoukankan      html  css  js  c++  java
  • 如何同步master的代码到fork分支代码

    同步master的代码到fork分支代码,分三步(remote项目fetch到本地仓库、基于本地master重新创建一个branch、新的branch上commit&push):

    1. 项目 fetch 到本地仓库,通过命令行的方式 merge

    a. git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
    b. git fetch upstream
    c. git checkout master(master换成lzc_first_branch,是否可以直接切到lzc_first_branch分支?,从而跳过第二步)
    d. git merge upstream/master(master换成lzc_first_branch,是否可以直接merge到lzc_first_branch分支?,从而跳过第二步)

    2. 基于本地master重新创建一个branch

     git checkout -b lzc_second_branch master

    或者

    git checkout master

     git checkout -b lzc_second_branch

    3. 基于该lzc_second_branch分支,提交到远程仓库

    a.  git commit -a 'sync codes from upstream'

    b. git push origin master(这个是push到fork之后的远程仓库)

    那么,有没有办法,直接从remote项目同步到remote的fork分支呢??

    参考:http://jinlong.github.io/2015/10/12/syncing-a-fork/

  • 相关阅读:
    CJB的大作
    OI省选算法汇总
    bzoj1078【SCOI2008】斜堆
    zrt中文题
    bzoj4726【POI2017】Sabota?
    bzoj4591 【Shoi2015】超能粒子炮·改
    bzoj2086【Poi2010】Blocks
    bzoj2091【Poi2010】The Minima Game
    bzoj2038小z的袜子
    bzoj4282慎二的随机数列
  • 原文地址:https://www.cnblogs.com/liuzc/p/6714965.html
Copyright © 2011-2022 走看看