【问题标题】:What's the difference between git subtree and just git cloning in a subdirectory?git subtree 和只是在子目录中克隆 git 有什么区别?
【发布时间】:2019-07-25 05:57:15
【问题描述】:

我开始觉得 git 子树只是子文件夹中的 git 克隆。

例如:

project/
   .git
   foo/
   bar/
   subtree/    # this could be a git subtree or just a git clone folder
   .gitignore

如果我只是将子树放在 .gitignore 中,然后 git 将我的另一个项目克隆到子树文件夹中,我会不会得到与子树相同的效果?子文件夹中的 git 克隆和 git 子树的有效区别是什么?

【问题讨论】:

    标签: git git-submodules git-subtree


    【解决方案1】:

    你可以这样看,但它们并不完全一样。

    一方面,子树在父 repo 上创建了与子树一的关系。 gitignored 目录中的克隆不会发生这种情况。 子树还可以帮助您在不获取所有历史记录的情况下跟踪远程仓库(请参阅--squash)。

    我脑子里只有两个区别。

    【讨论】:

      猜你喜欢
      • 2012-07-29
      • 2015-04-20
      • 1970-01-01
      • 2014-11-01
      • 2016-03-05
      • 2017-06-05
      • 1970-01-01
      • 2021-04-11
      相关资源
      最近更新 更多