当我做出一大堆更改时,我希望将其标记为版本。
我添加git tag v1.4
等
我如何自动将此添加到我为这些更改执行的提交中,此时我在完成提交后标记提交#并将其推送。
即:
git tag -a v1.2 cd8a721 -m "Message here"
答案 0 :(得分:1)
如何自动将此添加到我为这些更改所做的提交
你可以用GitHub网络钩子做到这一点。
在此处阅读有关活动的信息:https://developer.github.com/webhooks/#events
Note
强> 使用带注释的标记git tag -a
要好得多,因为它会创建一个提交,如标记,其中包含与提交相同的信息。
另一种拥有本地钩子的方法 - 当你提交设置标签然后推动分支和标签时。
post-commit hook
(本地挂钩)#!/bin/sh
# get the last commit Id
lastCommit = $(git log -1 HEAD)
tag = <generate the tag message you want to set>
git tag -a ...
echo " "
echo " |ZZzzz "
echo " | "
echo " | "
echo " |ZZzzz /^\ |ZZzzz "
echo " | |~~~| | "
echo " | |- -| / \ "
echo " /^\ |[]+ | |^^^| "
echo " |^^^^^^^| | +[]| | | "
echo " | +[]|/\/\/\/\^/\/\/\/\/|^^^^^^^| "
echo " |+[]+ |~~~~~~~~~~~~~~~~~~| +[]| "
echo " | | [] /^\ [] |+[]+ | "
echo " | +[]+| [] || || [] | +[]+| "
echo " |[]+ | || || |[]+ | "
echo " |_______|------------------|_______| "
echo " "
echo " "
echo " You have just committed and tagged "
echo " your code "