Automatically run Git hook when creating a Git tag

左心房为你撑大大i 提交于 2019-12-08 17:26:38

问题


Is there a Git hook which can be executed when a new Git tag is added? Because I want to automatically write new Git tag names into a textfile. Do you have a clue on how to do this?


回答1:


While it's not currently possible using hooks, you can always create a simple script.

mytag.sh :

#!/bin/sh
[ -z "$1" ] || ( git tag $1 && git tag > /path/to/your-tags-file )

then :

chmod +x mytag.sh
git config alias.mytag !/path/to/mytag.sh


来源:https://stackoverflow.com/questions/4309759/automatically-run-git-hook-when-creating-a-git-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!