gpt4 book ai didi

git - git subtree merge 和 git-subtree 有什么区别

转载 作者:IT王子 更新时间:2023-10-29 00:42:09 25 4
gpt4 key购买 nike

我刚刚找到了 git-subtree 工具,它在前一段时间成为主要 git repo 的一部分 https://github.com/apenwarr/git-subtree/

但是我不完全理解这个工具比现有的“git read-tree”+“git merge -s subtree”提供了什么功能。 git-subtree 的唯一目的是让生成的提交历史看起来更好,还是它有更多我忽略的功能?

最佳答案

您描述的命令将子树读入存储库。 git-subtree 命令有更多选项,如 the documentation. 所述。除其他外,您可以(为简单起见进行注释):

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 只是包装它们并使它们更容易执行。

关于git - git subtree merge 和 git-subtree 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11741249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com