[英]What is the difference between git subtree merge and git-subtree
我刚刚发现git-subtree工具,它在一段时间前已成为主要git repo https://github.com/apenwarr/git-subtree/的一部分
但是,我不完全了解该工具在已经存在的“ git read-tree” +“ git merge -s子树”上提供了什么功能。 是git-subtree的唯一目的-使生成的提交历史记录看起来更好还是它具有我忽略的更多功能?
您描述的命令将子树读取到存储库中。 git-subtree
命令具有更多选项,如文档所述。 除其他外,您可以(为简单起见而注解):
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.
还有各种各样的标志可以帮助和操纵以上内容。 我相信所有这些选项在通过管道命令链之前都是可用的。 git-subtree.sh
只是将它们包装起来,使它们易于执行。
如果您查看旧的子树代码,然后再将其作为contrib模块添加到git: https : //github.com/apenwarr/git-subtree/blob/master/git-subtree.sh,您会看到git子树工具实际上是围绕较低级别git子树合并策略的更高级包装器。
它基本上以一种明智的方式利用这些策略来简化子树的管理。 特别是壁球的东西真的非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.