在 Github UI 上移动标签

Moving tags on Github UI

我正在考虑使用命名约定(例如 QA、PROD、SERVER1)和挂钩 GIT 标签的选项,让用户可以将配置文件部署到特定环境和服务器池。这将要求用户在需要将一组新文件部署到给定环境时 "move" 他们的标签。不幸的是,虽然 CLI 似乎支持移动标签,但 Github UI 不允许这样做。

有什么方法可以通过 Github UI 来实现吗?或者,任何建议的替代方法来完成相同的,也将是伟大的。我可以使用分支约定和 branch-push 钩子触发器而不是标记约定,但我觉得这会降低用户的灵活性,并且如果分支太多,也可能会造成混淆。

提前致谢!

共享的、带注释的 Git 标签,就像您在 GitHub 上看到的那样 aren't meant to be moved:

But if you have pushed things out (or others could just read your repository directly), then others will have already seen the old tag. In that case you can do one of two things:

  1. The sane thing. Just admit you screwed up, and use a different name. Others have already seen one tag-name, and if you keep the same name, you may be in the situation that two people both have "version X", but they actually have different "X"'s. So just call it "X.1" and be done with it.

  2. The insane thing. You really want to call the new version "X" too, even though others have already seen the old one. So just use git tag -f again, as if you hadn’t already published the old one.

可以移动它们,但这很容易导致混乱,我强烈建议不要这样做。请注意,官方文档甚至称此选项为“疯狂”。 Some tools won't work as expected when tags are modified.

另一方面,branches 是为移动而设计的。为您要表示的每个环境创建一个分支并使它们保持更新,最好使用快进合并,这样您就不必强制执行任何操作。

我不相信 GitHub 网络 UI 可以自己做这件事。我认为您将不得不使用其他工具(可能是您已经在本地使用的任何客户端)。