github 同步到 原项目 以及 patch 到不同 branch。



1,  同步到原项目

  • #fork项目后与原项目进行同步  
  • #首先clone自己 
    leodemac-mini:git_test leo$ git clone https://github.com/bamboolsu/openwebrtc-examples


    #添加远程仓库    再将别人的版本库git remote add
    leodemac-mini:openwebrtc-examples leo$ git remote add bamboolsu https://github.com/EricssonResearch/openwebrtc-examples
    leodemac-mini:openwebrtc-examples leo$ git remote -v
    bamboolsu    https://github.com/EricssonResearch/openwebrtc-examples (fetch)
    bamboolsu    https://github.com/EricssonResearch/openwebrtc-examples (push)
    origin    https://github.com/bamboolsu/openwebrtc-examples (fetch)
    origin    https://github.com/bamboolsu/openwebrtc-examples (push)
    leodemac-mini:openwebrtc-examples leo$ git fetch bamboolsu

    leodemac-mini:openwebrtc-examples leo$ git merge bamboolsu/master


  • git remote add epix37 https://github.com/Epix37/Hearthstone-Deck-Tracker.git

  • #如果有冲突则需要手动解决冲突,

    leodemac-mini:openwebrtc-examples leo$ git merge bamboolsu/master

    leodemac-mini:openwebrtc-examples leo$ git commit -m "merge from bamboolsu"


    leodemac-mini:openwebrtc-examples leo$ git push -u origin master

  • #查看本地仓库 
    leodemac-mini:openwebrtc-examples leo$ git remote -v
    bamboolsu    https://github.com/EricssonResearch/openwebrtc-examples (fetch)
    bamboolsu    https://github.com/EricssonResearch/openwebrtc-examples (push)
    origin    https://github.com/bamboolsu/openwebrtc-examples (fetch)
    origin    https://github.com/bamboolsu/openwebrtc-examples (push)
    leodemac-mini:openwebrtc-examples leo$ git branch -a
    * master
      remotes/bamboolsu/master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
      remotes/origin/simpledemo-ios9


    检查确认:

    leodemac-mini:openwebrtc-examples leo$ gitk



    2, patch 操作

  • 生成patch

  • leodemac-mini:openwebrtc-examples___stefanalund leo$ git format-patch HEAD^
  •   生成   0001-modify-for-load-leo-s-page.patch

  • git format-patch -s 1bbe3c8c197a35f79bfddaba099270a2e54ea9c7


  • 或者使用

    git format-patch HEAD^ <==最近的1次commit的patch

    git format-patch HEAD^^ <==最近的2次commit的patch

    git format-patch HEAD^^^<==最近的3次commit的patch

    git format-patch HEAD^^^^ <==最近的4次commit的patch

    git format-patch HEAD^^^^^ <==不支持!!!!error!!!




  • 使用patch



  • 将补丁打上去。

    patch -p1 < 0001-Added-liuxingde-test.patch


  • 打開 patch 文件, 一開始就看得到 path 的路逕所在.

    -p[n] 的 n 值, 只要取消多少條 / 及其左邊的路逕.
    以 /usr/src/linux 為例,
    若 -p0 就是不取消任何路經
    -p1 則將 / 取消, 得 usr/src/linux
    -p2 則是將 /usr/ 取消, 得 src/linux
    再以 src/linux 為例:
    -p0 依然為 src/linux
    -p1 則為 linux

    如此類推...






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值