我如何对 git hooks 中的新标签做出反应?
我想设置一个 git hook,根据传入标签创建 CDN 样式的目录结构。因此,例如,如果本地存储库中的最后一个标签是“v1.2.1”并且我使用“v1.2.2”拉取提交,它应该看到新标签并将存储库直接克隆到新标签中(../1.2 .2) 相应地。
我很确定我想将其附加到接收后,但是我在有关 git hooks 的文档中找不到有关如何读取传入标签的任何内容。它们是通过不同的钩子交付的吗?我实际上是否需要让 shell 脚本运行 git 命令来查看新提交是否有新标签?
谢谢!
I'd like to set up a git hook that creates a CDN-style directory structure based on incoming tags. So, for example, if the last tag in the local repository is "v1.2.1" and I pull a commit with "v1.2.2", it should see the new tag and clone the repository into a new directly (../1.2.2) accordingly.
I'm pretty sure I want to attach this to post-receive, however I can't find anything in the documentation about git hooks about how to read the incoming tags. Are they delivered on a different hook? Do I actually need to have the shell script run a git command to see if any of the new commits have new tags?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标签和其他任何东西一样都是引用(比如提交)。
如果使用 post-receive 挂钩 将标签推送到存储库,则该挂钩将被调用并列出所有更新的引用,即所有引用的旧值和新值以及它们的名称(在其标准输入上)。
请参阅此服务器接收电子邮件后挂钩例如。
为此,您还必须安装函数文件上述示例挂钩存储库。
Tags are refs like any other (like commit).
If tags are pushed to a repo with a post-receive hook, that hook will be called and will list all updated refs, that is both old and new values of all the refs in addition to their names (on its standard input).
See this server post-receive email hook for example.
For this to work you also must install the functions file from the aforementioned example hook repository.