如何推动标签与GIT子树? [英] How to push tags with git subtree?

查看:103
本文介绍了如何推动标签与GIT子树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功创建了一个由git-subtree构成的subrepos的大回购,假设Master包含Slave1和Slave2。

Master /
Slave1 /
Slave2 /



现在我想在Master上标记并将每个标记推送到slave repos,我该怎么做?



如果我使用git push Slave2 --tags转移整个标签,但我只希望转移与Slave2相关的文件。



你可以使用git-subsplit来实现它,但它确实有点不实际和缓慢。



任何建议? How git 1.8.3(2013年5月)现在包含一个 git push --follow-tags 选项:


推送所有没有此选项时将被推送的引用,并且还会推送 refs / tags 中缺少远程但指向提交的注释标记你可以通过推送的ref来访问。


现在,请记住标签适用于完整的存储库(不是子目录),但一个想法是:

    $ b $如果状态稳定为,b
  • master 合并到' slave1_br Slave1 ,并在那里放置一个标签。 当你有一个 Slave2 的稳定状态时,将$ c>转换为' slave2_br ',并在其中放置一个标记。 / li>


然后:

  git push --follow_tags slave1 slave1_br 
git push --follow_tags slave2 slave2_br

这是唯一的我知道并非全部标签,但只有您推送的分支可以到达。

我意识到涉及多个分支( master ),但它可以替代 git-subsplit


I have successfully created a big repo made of a few subrepos with git-subtree, let's say Master contains Slave1 and Slave2.

Master/ Slave1/ Slave2/

Now I want to tag on Master and push each tag to the slave repos, how can I do it?

If I "git push Slave2 --tags" the entire tag is transferred, but I only want the files related to Slave2 to be transferred.

You can achieve it with git-subsplit, but it's honestly a bit unpractical and slow.

Any suggestion?

解决方案

As mentioned in "How to make "git push" include tags within a branch?", git 1.8.3 (May 2013) now includes a git push --follow-tags option:

Push all the refs that would be pushed without this option, and also push annotated tags in refs/tags that are missing from the remote but are pointing at commit-ish that are reachable from the refs being pushed.

Now, remember that a tag applies to the full repository (not a subdirectory), but one idea would be to:

  • merge master into a 'slave1_br' when you have a stable state of Slave1, and put a tag there.
  • merge master into a 'slave2_br' when you have a stable state of Slave2, and put a tag there.

And then:

git push --follow_tags slave1 slave1_br
git push --follow_tags slave2 slave2_br

That is the only way I know to not push all the tags, but only the one reachable from the branch you are pushing.
I realize that involves more than one branch (master), but it could be an alternative to git-subsplit.

这篇关于如何推动标签与GIT子树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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