git subtree merge和git-subtree有什么区别 [英] What is the difference between git subtree merge and git-subtree

查看:523
本文介绍了git subtree merge和git-subtree有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



然而,我不完全明白这个工具提供什么功能已有的git read-tree+git merge -s subtree。是唯一的git-subtree的purpouse - 使得结果提交历史看起来更好,还是它有更多我忽略的功能?

你描述的命令将一个子树读入一个存储库。 git-subtree 命令有更多选项,如文档。其中,您可以(注释为简单起见):

  add :: 
创建<前缀>通过从给定的< refspec>导入其内容
,或< repository>和远程< refspec> ;.
merge ::
将最近的更改合并到< commit>到<前缀>
子树。
pull ::
完全类似于'merge',但是在
中并行'git pull'它从指定的远程
仓库获取给定的提交。
push ::
使用<前缀>进行'拆分'(见上)提供
,然后执行'git push'将结果推送到
存储库并引用refspec。这可用于将
子树推送到远程存储库的不同分支。
split ::
从< prefix>的
历史记录中提取新的合成项目历史记录。子树。新历史
仅包括
影响<前>的提交(包括合并),并且这些提交中的每一个现在都具有< prefix>的
内容。在项目的根目录下,而不是子目录中的
。因此,新创建的历史
适合作为单独的git存储库导出。

还有各种帮助和操纵上述的标志。我相信所有这些选项都可以通过管道连接命令获得。 git-subtree.sh 只是包装它们,使它们更容易执行。


I've just found git-subtree tool that some time ago became a part of main git repo https://github.com/apenwarr/git-subtree/

However I don't fully understand what functionality does this tool provide over the already existing "git read-tree" + "git merge -s subtree". Is the only purpouse of git-subtree - making the resultant commit history look better or does it have more functionality that I've overlooked?

解决方案

The commands you describe reads a subtree into a repository. The git-subtree command has many more options, as described by the documentation. Among others, you can (annotated for simplicity):

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.

There are also a variety of flags that aid and manipulate the above. I believe all these options were available before via chains of plumbing commands. git-subtree.sh just wraps them and makes them considerably easier to execute.

这篇关于git subtree merge和git-subtree有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆