我刚刚发现git-subtree工具不久前成为主要git repo https://github.com/apenwarr/git-subtree/的一部分。
然而,我并不完全理解这个工具在已经存在的"git read-tree“+ "git merge -s subtree”上提供了什么功能。git-subtree的唯一用途是让结果提交历史看起来更好,还是它有更多我忽略了的功能?
发布于 2012-07-31 22:24:16
您描述的命令将子树读入存储库。正如the documentation.等人所描述的那样,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只是包装了它们,并使它们更容易执行。
发布于 2013-06-20 00:23:16
如果你看一下以前的子树代码,然后将它作为一个contrib模块添加到git中:https://github.com/apenwarr/git-subtree/blob/master/git-subtree.sh,你会发现git子树工具实际上是一个更高级的包装器,它包含了更低级别的git子树合并策略。
它基本上以一种合理的方式利用这些策略,使子树管理变得更加容易。尤其是--壁球的东西真的非常有用。
https://stackoverflow.com/questions/11741249
复制相似问题