Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git子树合并和git子树合并有什么区别_Git_Git Merge_Git Subtree - Fatal编程技术网

git子树合并和git子树合并有什么区别

git子树合并和git子树合并有什么区别,git,git-merge,git-subtree,Git,Git Merge,Git Subtree,我刚刚发现了git子树工具,它在不久前已经成为主要git回购协议的一部分 然而,我不完全理解这个工具在已经存在的“git读取树”+“git合并-s子树”上提供了什么功能。git子树的唯一目的是使生成的提交历史看起来更好,还是它有我忽略的更多功能?您描述的命令将子树读取到存储库中。git子树命令有更多选项,如所述,您可以(为简单起见进行注释): add:: 通过导入子树的内容来创建子树 从给定的或和远程。 合并:: 将最近的更改合并到 子树。 拉力:: 与“merge”完全相同,但与“git p

我刚刚发现了git子树工具,它在不久前已经成为主要git回购协议的一部分


然而,我不完全理解这个工具在已经存在的“git读取树”+“git合并-s子树”上提供了什么功能。git子树的唯一目的是使生成的提交历史看起来更好,还是它有我忽略的更多功能?

您描述的命令将子树读取到存储库中。
git子树
命令有更多选项,如所述,您可以(为简单起见进行注释):

add::
通过导入子树的内容来创建子树
从给定的或和远程。
合并::
将最近的更改合并到
子树。
拉力::
与“merge”完全相同,但与“git pull”相似
它从指定的远程服务器获取给定的提交
存储库。
推送:
使用提供的
然后执行“git push”将结果推送到
存储库和refspec。这可以用来推动你的
远程存储库的不同分支的子树。
拆分::
从中提取新的合成项目历史记录
子树的历史。新历史
仅包括以下内容的提交(包括合并):
受影响,并且每个提交现在都具有
的内容改为位于项目的根目录下
子目录中的。因此,新创造的历史
适合作为单独的git存储库导出。

还有各种各样的标志可以帮助和操纵上面的内容。我相信所有这些选项以前都是通过管道命令链提供的
git subtree.sh
只是包装它们,使它们更易于执行。

如果您查看作为contrib模块添加到git之前的旧子树代码:您可以看到git subtree工具实际上是围绕较低级别git子树合并策略的更高级包装器

它基本上以一种合理的方式利用这些策略,使子树管理更加容易。特别是壁球的东西非常非常有用

add::
    Create the <prefix> subtree by importing its contents
    from the given <refspec> or <repository> and remote <refspec>.
merge::
    Merge recent changes up to <commit> into the <prefix>
    subtree.
pull::
    Exactly like 'merge', but parallels 'git pull' in that
    it fetches the given commit from the specified remote
    repository.
push::
    Does a 'split' (see above) using the <prefix> supplied
    and then does a 'git push' to push the result to the 
    repository and refspec. This can be used to push your
    subtree to different branches of the remote repository.
split::
    Extract a new, synthetic project history from the
    history of the <prefix> subtree.  The new history
    includes only the commits (including merges) that
    affected <prefix>, and each of those commits now has the
    contents of <prefix> at the root of the project instead
    of in a subdirectory.  Thus, the newly created history
    is suitable for export as a separate git repository.