Git 子树标签
我想使用子树合并将远程项目拉入我自己的 git 树中的目录中。我按照这里的说明进行操作: 使用子树合并
但我不知道如何签出标签。我想这是一个常见的请求 - 您想要引入外部项目,但获得源代码的安全标记版本。 子树合并解决方案效果很好,但我不确定如何获取我想要的标签?喜欢 git,但有时它会伤害我的头......
I want to use subtree merges to pull a remote project into a directory in my own git tree. I followed the instructions here:
using subtree merge
But I'm not sure how to checkout a tag. I imagine this is a common request - you want to pull in an external project but get a safe tagged version of the source.
The subtree merge solution works great, but I'm not sure how to get the tag I want? Love git, but sometimes it hurts my head....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您输入 git tag 时,您将获得存储库中所有标签的列表。远程标签也显示在这里,我不知道它们是否可能冲突(没有检查),以及如何检查哪些标签导入到您的存储库。
但我检查的是,当您添加远程并从其他项目获取时,您会看到导入了哪些标签。然后您可以与该标签合并,例如:
它应该可以工作。
希望它能有点帮助,但我对 git 的了解并不像我希望的那么先进:-)
When you type
git tag
you'll get list of all tags in your repository. Remote tags also show here, and I don't know if they may conflict (didn't check that), and how to check what tags were imported to your repository.But what I checked is that when you add remote and it fetches from other project, you see what tags are imported. Then you can merge with that tag, for example:
and it should work.
Hope it helps a little, but I'm not as advanced with git as I would like :-)
GitHub 采用了 kernel.org 的 HowTo:http://help.github.com/subtree-merge /
GitHub has an adoption of the kernel.org's HowTo: http://help.github.com/subtree-merge/
我在 Github 上的一个示例项目中做到了这一点,该项目名为 hesco/ hesco-weave如下:
我使用了curl,jq,剪切和 tail 命令在下面的示例中,因此您需要在运行示例之前拥有它们。
首先,找到项目的最后两个标签:
或者如果您有该项目的签出版本:
引用的sha如下:
第二,一个git存储库创建:
第三,Github存储库的v0.8.6标签作为子树添加到创建的存储库中:
跟踪信息:
最后,带有较新标签v0的weave子树.8.7 与 git subtree pull 合并:
跟踪信息:
I did it for a sample project on Github which is called hesco/hesco-weave as follows:
I used curl, jq, cut and tail commands in the following examples, so you need to have them before running the examples.
First, the two last tags of the project are found :
Or if you have a checkouted version of the project:
the sha of refs are as follows:
Second, a git repository is created:
Third, the v0.8.6 tag of the Github's repository is added to the created repository as subtree :
Trace info:
Finally, the weave subtree with the newer tag v0.8.7 is merged with
git subtree pull
:Trace info: