且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何推动标签与GIT子树?

更新时间:2023-01-17 18:23:56

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.