参考地址:https://www.php.cn/manual/view/35125.html
参考地址:https://laozhu.me/post/git-submodule-tutorial/
https://www.jianshu.com/p/0107698498af
1、创建公共库
$ git clone http://....
... 做你想做的公共内容,之后提交到master,再然后将你对外暴露的结构文件提交到希望提交的分支
$ git checkout -b xx
$ git subtree push --prefix 目录 origin xx
2、自己的项目站点
$ git submodule add -b xx https://.... 目录
这个时候仓库下面多出了一个 .gitmodules 文件,该文件列出了所包含的子模块列表,并为列表中每一个子模块指定了本地路径(path)和远程仓库地址(url),除此以外我们还可选为子模块指定 branch 分支,不指定默认为 master 分支。
顺便观摩一下 Hugo Themes 仓库的 .gitmodules 引用文件。
更新:git submodule update --remote
为了确保当前的跟踪分支状态,update --remote在计算 SHA-1 之前获取子模块的远程存储
或者直接cd到你子模块,进行git pull
操作进行更新