本文以 skywalking-rocketbot-ui子模块合并到 skywalking 为例,手把手教你如何把 Git 子模块更新到主项目中去。

首先,把fork的skywalking项目克隆到本地:

OneMore MINGW64 /d/code
$ git clone https://github.com/heihaozi/skywalking.git skywalking
Cloning into 'skywalking'...
remote: Enumerating objects: 241687, done.
remote: Counting objects: 100% (373/373), done.
remote: Compressing objects: 100% (201/201), done.
remote: Total 241687 (delta 64), reused 240 (delta 21), pack-reused 241314
Receiving objects: 100% (241687/241687), 156.98 MiB | 3.83 MiB/s, done.
Resolving deltas: 100% (93272/93272), done.
Updating files: 100% (5928/5928), done.

进入skywalking目录,设置用户名和邮箱:

OneMore MINGW64  /d/code
$ cd skywalking/ OneMore MINGW64 /d/code/skywalking (master)
$ git config user.name CharliePu OneMore MINGW64 /d/code/skywalking (master)
$ git config user.email heihaozi2006@163.com

指定将与复刻同步的远程上游仓库:

OneMore MINGW64  /d/code/skywalking (master)
$ git remote add upstream https://github.com/apache/skywalking.git

查看一下远程上游仓库是否生效:

OneMore MINGW64  /d/code/skywalking (master)
$ git remote -v
origin https://github.com/heihaozi/skywalking.git (fetch)
origin https://github.com/heihaozi/skywalking.git (push)
upstream https://github.com/apache/skywalking.git (fetch)
upstream https://github.com/apache/skywalking.git (push)

没有问题,初始化本地子模块:

OneMore MINGW64  /d/code/skywalking (master)
$ git submodule init
Submodule 'apm-protocol/apm-network/src/main/proto' (https://github.com/apache/skywalking-data-collect-protocol.git) registered for path 'apm-protocol/apm-network/src/main/proto'
Submodule 'oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol' (https://github.com/apache/skywalking-query-protocol.git) registered for path 'oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol'
Submodule 'skywalking-ui' (https://github.com/apache/skywalking-rocketbot-ui.git) registered for path 'skywalking-ui'
Submodule 'test/e2e/e2e-protocol/src/main/proto' (https://github.com/apache/skywalking-data-collect-protocol.git) registered for path 'test/e2e/e2e-protocol/src/main/proto'

从子模块的远端更新修改:

OneMore MINGW64  /d/code/skywalking (master)
$ git submodule update
Cloning into 'D:/code/skywalking/apm-protocol/apm-network/src/main/proto'...
Cloning into 'D:/code/skywalking/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol'...
Cloning into 'D:/code/skywalking/skywalking-ui'...
Cloning into 'D:/code/skywalking/test/e2e/e2e-protocol/src/main/proto'...
Submodule path 'apm-protocol/apm-network/src/main/proto': checked out 'e626ee04850703c220f64b642d2893fa65572943'
Submodule path 'oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol': checked out '47202fc1eaa1864c587a78f423a0685ffbe294ad'
Submodule path 'skywalking-ui': checked out '9e56d6cbbaff4678751f5355b953db3bbfd99c9b'
Submodule path 'test/e2e/e2e-protocol/src/main/proto': checked out 'e626ee04850703c220f64b642d2893fa65572943'

从子模块的远端拉取上游的修改:

OneMore MINGW64  /d/code/skywalking (master)
$ git submodule update --remote
Submodule path 'skywalking-ui': checked out '774b69dd84e305be975e4c5ffc0d433aa8cbda32'

检查当前文件状态:

OneMore MINGW64  /d/code/skywalking (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'. Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: skywalking-ui (new commits) no changes added to commit (use "git add" and/or "git commit -a")

发现skywalking-ui已经有更新了,可以直接将其提交到远端,也可以修改其他文件一起提交。

这里先修改一下CHANGES.md文件,然后一起提交:

OneMore MINGW64  /d/code/skywalking (master)
$ git add skywalking-ui OneMore MINGW64 /d/code/skywalking (master)
$ git add CHANGES.md OneMore MINGW64 /d/code/skywalking (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'. Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: CHANGES.md
modified: skywalking-ui OneMore MINGW64 /d/code/skywalking (master)
$ git push origin master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 409 bytes | 409.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/heihaozi/skywalking.git
50688c187..e4a61f183 master -> master

至此,大功告成,可以向社区提交PR了。

微信公众号:万猫学社

微信扫描二维码

关注后回复「电子书」

获取12本Java必读技术书籍

最后,感谢你的点赞关注,帅气又美丽。

手把手教你把 Git 子模块更新到主项目的更多相关文章

  1. 手把手教你用git和SourceTree上传项目到github细解(转)

    尊重原创:https://blog.csdn.net/qq_32365567/article/details/52859166 一.引言 我想大家现在都很熟悉github了,也能运用github上开源 ...

  2. 手把手教你使用Git管理你的软件代码

    什么是分布式版本控制系统?Git有哪些常用命令?什么是仓库?Git的操作区域包括哪些?Git有哪些常用对象(object)?git rebase和git merge的区别是什么?git reset,g ...

  3. 推荐!手把手教你使用Git

    推荐!手把手教你使用Git 原文出处: 涂根华的博客   http://blog.jobbole.com/78960/ 一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与 ...

  4. 【转载】手把手教你使用Git(简单,实用)

    手把手教你使用Git(简单,实用) 标签: git 2016年04月21日 20:51:45 1328人阅读 评论(0) 收藏 举报 一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. ...

  5. 手把手教你如何使用Cocos2d Console 进行html5项目发布

    手把手教你如何使用Cocos2d Console 进行html5项目发布   1.首先需要先安装Cocos2d Console运行需要的工具. 详情参见 这篇文章 http://www.cocoach ...

  6. 转:手把手教你如何玩转Solr(包含项目实战)

    原文地址:手把手教你如何玩转Solr(包含项目实战) 参考原文

  7. 手把手教你使用Git

    一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以 ...

  8. Git之 手把手教你使用Git

    一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以 ...

  9. 《转》手把手教你使用Git

    Git是分布式版本控制系统,那么它就没有中央服务器的,每个人的电脑就是一个完整的版本库,这样,工作的时候就不 需要联网了,因为版本都是在自己的电脑上.既然每个人的电脑都有一个完整的版本库,那多个人如何 ...

随机推荐

  1. 我把自己的java库发布到了maven中央仓库,从此可以像Jackson、Spring的jar一样使用它了

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  2. [Jetson Nano]Jetson Nano快速入门

    NVIDIAJetsonNano开发套件是适用于制造商,学习者和开发人员的小型AI计算机.相比Jetson其他系列的开发板,官方报价只要99美金,可谓是相当有性价比.本文如何是一个快速入门的教程,主要 ...

  3. 【刷题-LeetCode】215. Kth Largest Element in an Array

    Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is t ...

  4. openssl基本原理 + 生成证书(转)

    https://blog.csdn.net/cpcpcp123/article/details/108885922 https://liruzhen.blog.csdn.net/article/det ...

  5. Go 转义字符及风格

    今天来学习一下Go 中的转义字符,源码注释,规范的代码风格以及标准库API 文档; Go 转义字符常用的转义字符有以下几个:1. \t: 表示一个制表符(tab), 通常可以使用它进行排版; 2. \ ...

  6. 沁恒CH32F103C8T6的开发和烧录配置说明

    概述 CH32F1系列是沁恒生产的32位Cortex-M3 MCU, 片上集成了时钟安全机制.多级电源管理. 通用DMA控制器等. 此系列具有 2 路 USB2.0接口.多通道 TouchKey. 1 ...

  7. setcontext+orw

    setcontext+orw 大致可以把2.27,2.29做为两个分界点. 我们先来讨论 2.27 及以下的 setcontext + orw 的写法. 首先 setcontext 是什么?了解过 S ...

  8. kubernetes之部署traefik-ingress分为http和https

    1 理解Ingress 简单的说,ingress就是从kubernetes集群外访问集群的入口,将用户的URL请求转发到不同的service上.Ingress相当于nginx.apache等负载均衡方 ...

  9. Tomcat多实例单应用部署方案 (转)

    一.Tomcat部署的场景分析 通常,我们对tomcat部署需求可以分为几种:单实例单应用,单实例多应用,多实例单应用,多实例多应用. 对于第一种场景,如果不要求周期性地维护tomcat版本,一般的做 ...

  10. Android--控件的滑动事件

    感谢大佬:https://www.cnblogs.com/zkb-0928/p/3768209.html 感谢大佬:https://blog.csdn.net/sweiqin/article/deta ...