在git中标记多个分支? [英] Tag multiple branches in git?

查看:158
本文介绍了在git中标记多个分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有两个分支的git仓库;一个用于制造/测试的代码,一个是实际的生产固件(它们几乎完全相同)。现在是时候削减发布给制造商,所以我自然想在两个分支上放一些适当的标签。

但是,似乎git不会让我在两个分支上放置相同的标记名称。如果我尝试单独标记分支,它会告诉我标记秒分支时标记已存在。我试着将两个提交传递给git标签,但它也不喜欢这个。我不一定需要总是用锁步标记这两个分支,但我不想为了避免名称冲突而将随机字符添加到标记。



是有什么方法可以做我想做的,或者我想做错的事情?




一个分支是代码制造商会将该设备用于测试它是否正确组装。另一个分支是产品中的代码。这不是每个版本的两个分支。这是这个产品的第一个版本,因此这两个分支都是第一个版本,所以我试图用'release-1.0'来标记两个分支。

解决方案

你想做错事。标签的目的是明确识别特定的修订。如果我是你,我只会标记生产分支,并将测试分支保留为未标记。



然而,每个发行版都有两个独立的分支。为什么是这样?答案可能有助于描述更好的解决方案。






由于标签实际上不应指向相同的修订版,但(可能)不同的版本,标签应该是这样的:


  • appname-1.0-manufacturing

  • appname-1.0-production



通过这种方式,您将知道每个标签属于哪个版本,以及代码结束的位置。


I have a git repository with two branches; one for code that's used for manufacturing/test and one that's the actual production firmware (they're nearly identical). It's now time to cut a release to send to the manufacturer, so I naturally want to put down some appropriate tags on both branches.

But, it seems that git won't let me put the same tag name on both branches. If I try to tag the branches individually it tells me the tag already exists when I go to tag the seconds branch. I tried passing two commits to git tag, but it didn't like that either. I don't necessarily need to always tag the two branches in lockstep, but I don't want to add random characters to the tags just to avoid name collisions.

Is there some way to do what I want, or am I wanting to do the wrong thing?


One branch is the code that manufacturing puts on the device to test that it was assembled properly. The other branch is the code that ships in the product. It's not really two branches per release. This is the first release for this product, and therefore first release for both branches, so I tried to tag both branches with 'release-1.0'.

解决方案

You're wanting to do the wrong thing. The purpose of a tag is to unambiguously identify a particular revision. If I were you, I'd tag only the production branch and leave the testing branch untagged.

However, it's pretty weird that you've got two independent branches per release. Why is this? The answer might help to describe a better solution.


Since the tags aren't really supposed to point to the same revision, but (potentially) different revisions, the tags should be something like this:

  • appname-1.0-manufacturing
  • appname-1.0-production

That way, you will know which release each tag belongs to, as well as where the code ended up.

这篇关于在git中标记多个分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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