{"id":620,"date":"2020-08-14T10:57:08","date_gmt":"2020-08-14T02:57:08","guid":{"rendered":"http:\/\/123.57.164.21\/?p=620"},"modified":"2025-08-20T14:28:56","modified_gmt":"2025-08-20T06:28:56","slug":"github-%e6%89%93tag","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=620","title":{"rendered":"Github \u6253Tag"},"content":{"rendered":"\n<p>github\u4e2d\u6709branch\u548ctag\uff0c\u4e5f\u5c31\u662f\u5206\u652f\u548c\u6807\u7b7e\u7684\u6982\u5ff5\u3002\u5c31\u6211\u76ee\u524d\u7684\u7406\u89e3\u800c\u8a00\uff0cbranch\u662f\u7528\u6765\u5b58\u653e\u6700\u7ec8\u4ee3\u7801\u7684\uff0c\u800ctag\u662f\u7528\u6765\u63cf\u8ff0\u4f60\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u662f\u5982\u4f55\u4e00\u6b65\u6b65\u5230\u8fbe\u6700\u7ec8\u76ee\u7684\uff0c\u5c31\u50cf\u522b\u4eba\u8bf4\u7684\u91cc\u7a0b\u7891\u3002\u6bd4\u5982\u4f60\u65b0\u5efa\u4e86\u591a\u4e2atag\uff0c\u5206\u522b\u4e3av1.0 v2.0 v3.0&#8230;.\u5c31\u662f\u6709\u5f88\u591a\u4e2a\u7248\u672c\uff0c\u7136\u540ev1.0\u662f\u5b9e\u73b0A\u529f\u80fd\uff0cv2.0\u662f\u5b9e\u73b0A+B\u529f\u80fd\uff0cv3.0\u662f\u5b9e\u73b0A+B+C\u529f\u80fd\u3002\u8fd9\u5c31\u662ftag\u7684\u529f\u80fd\u4e86\uff0c\u7136\u540e\u6700\u540e\u7248\u672c\u7684tag\u5728push\u5230branch\u91cc\u3002\u4ece\u5b58\u50a8\u4e0a\u770b\uff0ctag\u548cbranch\u662f\u5e76\u5217\u7684\uff0c\u4f46\u662f\u4ece\u6211\u4eec\u7ed9\u4ed6\u7684\u903b\u8f91\u5173\u7cfb\u4e0a\u770b\uff0ctag\u662f\u5c5e\u4e8ebranch\u91cc\u7684\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u6807\u7b7e\u7ba1\u7406<\/strong> \ud83d\udd16<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u53d1\u5e03\u4e00\u4e2a\u7248\u672c\u65f6\uff0c\u6211\u4eec\u901a\u5e38\u5148\u5728\u7248\u672c\u5e93\u4e2d\u6253\u4e00\u4e2a\u6807\u7b7e\uff08tag\uff09\uff0c\u8fd9\u6837\uff0c\u5c31\u552f\u4e00\u786e\u5b9a\u4e86\u6253\u6807\u7b7e\u65f6\u523b\u7684\u7248\u672c\u3002\u5c06\u6765\u65e0\u8bba\u4ec0\u4e48\u65f6\u5019\uff0c\u53d6\u67d0\u4e2a\u6807\u7b7e\u7684\u7248\u672c\uff0c\u5c31\u662f\u628a\u90a3\u4e2a\u6253\u6807\u7b7e\u7684\u65f6\u523b\u7684\u5386\u53f2\u7248\u672c\u53d6\u51fa\u6765\u3002\u6240\u4ee5\uff0c\u6807\u7b7e\u4e5f\u662f\u7248\u672c\u5e93\u7684\u4e00\u4e2a\u5feb\u7167\u3002<\/p>\n\n\n\n<p>Git\u7684\u6807\u7b7e\u867d\u7136\u662f\u7248\u672c\u5e93\u7684\u5feb\u7167\uff0c\u4f46\u5176\u5b9e\u5b83\u5c31\u662f\u6307\u5411\u67d0\u4e2acommit\u7684\u6307\u9488\uff08\u8ddf\u5206\u652f\u5f88\u50cf\u5bf9\u4e0d\u5bf9\uff1f\u4f46\u662f\u5206\u652f\u53ef\u4ee5\u79fb\u52a8\uff0c\u6807\u7b7e\u4e0d\u80fd\u79fb\u52a8\uff09\uff0c\u6240\u4ee5\uff0c\u521b\u5efa\u548c\u5220\u9664\u6807\u7b7e\u90fd\u662f\u77ac\u95f4\u5b8c\u6210\u7684\u3002<\/p>\n\n\n\n<p>\u3000<br><\/p>\n\n\n\n<p><strong>\u4e3a\u4ec0\u4e48\u5f15\u5165\u6807\u7b7e\uff08tag\uff09\uff1f<\/strong> \ud83d\udd16<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Git\u6709commit\uff0c\u4e3a\u4ec0\u4e48\u8fd8\u8981\u5f15\u5165tag\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u201c\u8bf7\u628a\u4e0a\u5468\u4e00\u7684\u90a3\u4e2a\u7248\u672c\u6253\u5305\u53d1\u5e03\uff0ccommit\u53f7\u662f6a5819e\u2026\u201d<br>\u201c\u4e00\u4e32\u4e71\u4e03\u516b\u7cdf\u7684\u6570\u5b57\u4e0d\u597d\u627e\uff01\u201d<br><br>\u5982\u679c\u6362\u4e00\u4e2a\u529e\u6cd5\uff1a<br> \u201c\u8bf7\u628a\u4e0a\u5468\u4e00\u7684\u90a3\u4e2a\u7248\u672c\u6253\u5305\u53d1\u5e03\uff0c\u7248\u672c\u53f7\u662fv1.2\u201d<br> \u201c\u597d\u7684\uff0c\u6309\u7167tag v1.2\u67e5\u627ecommit\u5c31\u884c\uff01\u201d<\/pre>\n\n\n\n<p>\u6240\u4ee5\uff0c<strong>tag\u5c31\u662f\u4e00\u4e2a\u8ba9\u4eba\u5bb9\u6613\u8bb0\u4f4f\u7684\u6709\u610f\u4e49\u7684\u540d\u5b57<\/strong>\uff0c\u5b83\u8ddf\u67d0\u4e2acommit\u7ed1\u5728\u4e00\u8d77\u3002<\/p>\n\n\n\n<p>\u5f53\u6211\u4eec\u5728git\u7248\u672c\u63a7\u5236\u4e2d\u9047\u5230\u4e86\u4e00\u4e9b\u91cc\u7a0b\u7891\u7684commit\uff0c\u4f8b\u5982\u5f53\u6211\u4eec\u7684\u4ea7\u54c1\u4e3b\u8981\u529f\u80fd\u5f00\u53d1\u5b8c\u6210\uff0c\u53ef\u4ee5\u4ea4\u4ed8\u7ed9\u5ba2\u6237\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2atag\u6765\u4f5c\u4e3a\u4e00\u4e2a\u5927\u7248\u672c\u6807\u8bb0\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728\u4ee5\u540e\u7684\u67d0\u4e2a\u65f6\u523b\uff0c\u5feb\u901f\u5b9a\u4f4d\u4e00\u4e2a\u5f00\u53d1\u9636\u6bb5\uff0c\u65b9\u4fbf\u6211\u4eec\u521b\u5efa\u4e00\u4e2abranch\u6216\u8005checkout\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\u4e0b\u9762\u7684\u56fe\uff0c\u5c31\u662f\u5229\u7528github desktop\u5728commit\u4e0a\u521b\u5efa\u4e00\u4e2atag<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1003\" height=\"1024\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-1003x1024.png\" alt=\"\" class=\"wp-image-17002\" style=\"width:344px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-1003x1024.png 1003w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-294x300.png 294w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-768x784.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-830x847.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-230x235.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-350x357.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image-480x490.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/03\/image.png 1050w\" sizes=\"(max-width: 1003px) 100vw, 1003px\" \/><\/figure><\/div>\n\n\n<ul>\n<li><strong>\u67e5\u770btag<\/strong><\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u67e5\u770btag\uff0c\u5217\u51fa\u6240\u6709tag\uff0c\u5217\u51fa\u7684tag\u662f\u6309\u5b57\u6bcd\u6392\u5e8f\u7684\uff0c\u548c\u521b\u5efa\u65f6\u95f4\u6ca1\u5173\u7cfb\u3002\n$ git tag\nv0.1\nv1.3<\/pre>\n\n\n\n<ul>\n<li><strong>\u663e\u793atag\u8be6\u7ec6\u4fe1\u606f<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u6ce8\u610f\uff0c<strong>\u6807\u7b7e\u4e0d\u662f\u6309\u65f6\u95f4\u987a\u5e8f\u5217\u51fa\uff0c\u800c\u662f\u6309\u5b57\u6bcd\u6392\u5e8f\u7684<\/strong>\u3002\u53ef\u4ee5\u7528git show &lt; tagname &gt;\u67e5\u770b\u6807\u7b7e\u4fe1\u606f\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u663e\u793a\u6307\u5b9atag\u7684\u4fe1\u606f\n$ git show v1.4\ntag v1.4\nTagger: Scott Chacon &lt;schacon@gee-mail.com>\nDate:   Mon Feb 9 14:45:11 2009 -0800\n\nmy version 1.4\n\ncommit 15027957951b64cf874c3557a0f3547bd83b3ff6\nMerge: 4a447f7... a6b4c97...\nAuthor: Scott Chacon &lt;schacon@gee-mail.com>\nDate:   Sun Feb 8 19:02:46 2009 -0800\n\n    Merge branch 'experiment'<\/pre>\n\n\n\n<ul>\n<li><strong>\u521b\u5efatag<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u5728Git\u4e2d\u6253\u6807\u7b7e\u975e\u5e38\u7b80\u5355\uff0c\u9996\u5148\uff0c\u5207\u6362\u5230\u9700\u8981\u6253\u6807\u7b7e\u7684\u5206\u652f\u4e0a\uff0c\u7136\u540e\uff0c<strong>\u6572\u547d\u4ee4git tag &lt; name &gt;\u5c31\u53ef\u4ee5\u6253\u4e00\u4e2a\u65b0\u6807\u7b7e<\/strong><\/p>\n\n\n\n<p>\u9ed8\u8ba4\u6807\u7b7e\u662f\u6253\u5728\u6700\u65b0\u63d0\u4ea4\u7684commit\u4e0a\u7684\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u521b\u5efa\u8f7b\u91cf\u7ea7tag\uff1a\u8fd9\u6837\u521b\u5efa\u7684tag\u6ca1\u6709\u9644\u5e26\u5176\u4ed6\u4fe1\u606f\ngit tag v1.0<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u5e26\u4fe1\u606f\u7684tag\uff1a-m\u540e\u9762\u5e26\u7684\u5c31\u662f\u6ce8\u91ca\u4fe1\u606f\uff0c\u8fd9\u6837\u5728\u65e5\u540e\u67e5\u770b\u7684\u65f6\u5019\u4f1a\u5f88\u6709\u7528\ngit tag -a v1.0 -m 'first version'<\/pre>\n\n\n\n<ul>\n<li><strong>\u4e0a\u4f20tag\u5230branch<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u6211\u4eec\u5728\u6267\u884c git push \u7684\u65f6\u5019\uff0ctag\u662f\u4e0d\u4f1a\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u7684\uff0c\u6bd4\u5982\u73b0\u5728\u7684github\uff0c\u521b\u5efa tag \u540e git push \uff0c\u5728github\u7f51\u9875\u4e0a\u662f\u770b\u4e0d\u5230tag \u7684\uff0c\u4e3a\u4e86\u5171\u4eab\u8fd9\u4e9btag\uff0c\u4f60\u5fc5\u987b\u8fd9\u6837\uff1a\ngit push origin v1.0\n\u6216\u8005\n\/\/\u5c06\u6240\u6709tag \u4e00\u6b21\u5168\u90e8push\u5230github\u4e0a\u3002\ngit push origin --tags<\/pre>\n\n\n\n<ul>\n<li><strong>\u5220\u9664tag<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u5220\u9664\u672c\u5730tag\ngit tag -d v1.0<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u5220\u9664github\u8fdc\u7aef\u7684\u6307\u5b9atag\ngit push origin :refs\/tags\/v1.0.0<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>github\u4e2d\u6709branch\u548ctag\uff0c\u4e5f\u5c31\u662f\u5206\u652f\u548c\u6807\u7b7e\u7684\u6982\u5ff5\u3002\u5c31\u6211\u76ee\u524d\u7684\u7406\u89e3\u800c\u8a00\uff0cbranch\u662f\u7528\u6765\u5b58\u653e\u6700\u7ec8\u4ee3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/620"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=620"}],"version-history":[{"count":9,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/620\/revisions"}],"predecessor-version":[{"id":17001,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/620\/revisions\/17001"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}