美文网首页
git subtree

git subtree

作者: 突突兔007 | 来源:发表于2020-01-07 18:04 被阅读0次

git subtree

1.在A项目中添加一个远程连接如下:

git remote add subtree-origin git@github.com:xxx/xxx/x.git

2.使用subtree命令添加需要依赖的远程仓库

git subtree add --prefix=subtree(目录) subtree-origin master

该命令解释如下:
从subtree-origin这个远程地址拉取master分支到本地的subtree目录

3.在parent项目里拉取子模块

git subtree pull --prefix=subtree subtree-origin master --squash

# 此命令为:拉取subtree-origin上的master分支到本地的subtree上
--squash : 
无此参数,则会把子模块的所有提交记录一条一条的拉取过来,在去穿件一个合并提交,
有此参数,则把所有子模块的所有提交记录合并为一条提交,在把合并的提交merge到当前分支上,所以到时候在主项目上会多出来两个提交,子模块远程提交历史在本地上就没有了。

4.在parent项目里修改child模块并将对child相关的修改推送到parent的远程仓库和child本身的远程仓库

git subtree push --prefix=subtree subtree-origin master
命令意思使用git subtree push命令把对本地subtree的修改推送到远程subtree-origin 的master分支上。

相关文章

  • git subtree 的命令和使用说明

    git subtree add --prefix= git subtree add --...

  • git subtree 的使用

    参考:Git Tools - Subtree MergingThe power of Git subtreegit...

  • git merge two repos

    git clone git_linkFirstly add subtree, from which you wan...

  • Git依赖subtree

    Git依赖——subtree  与submodule相比,subtree的优势在于主项目与子模块的双向 通信,即主...

  • git subtree

    使用GIT SUBTREE集成项目到子目录 使用场景 例如,在项目Game中有一个子目录AI。Game和AI分别是...

  • git subtree

    在生成gitHub page ,打算将打包的doc 文件单独作为一个github page 分支时候了解到一个gi...

  • git subtree

    git subtree 1.在A项目中添加一个远程连接如下: 2.使用subtree命令添加需要依赖的远程仓库 3...

  • git subtree教程

    关于子仓库或者说是仓库共用,git官方推荐的工具是git subtree。 我自己也用了一段时间的git subt...

  • git-subtree

    多个工程,存在通用目录或文件内容 举例 工程P1,目录结构: src1utils1test.jsp1.js 工程P...

  • 版本库之间的依赖

    Git submodule和Git subtree 与子模块之间的依赖 对于子模块来说,其模块版本库可以被嵌入到主...

网友评论

      本文标题:git subtree

      本文链接:https://www.haomeiwen.com/subject/qgnkactx.html