{"id":19006,"date":"2024-11-19T13:37:04","date_gmt":"2024-11-19T05:37:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19006\/"},"modified":"2024-11-19T13:37:04","modified_gmt":"2024-11-19T05:37:04","slug":"gitlab%e5%ad%a6%e4%b9%a0%e4%b9%8b%e4%bc%81%e4%b8%9a%e5%b8%b8%e7%94%a8%e7%9a%84%e4%b8%80%e4%ba%9bgit%e8%a7%84%e8%8c%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19006\/","title":{"rendered":"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/64268a226ead6208.jpg\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe\" \/><\/p>\n<p>\u4fd7\u8bdd\u8bf4\uff0c\u6ca1\u6709\u89c4\u77e9\u4e0d\u6210\u65b9\u5706\uff0c\u6211\u4eec\u7684\u4e5f\u9700\u8981\u89c4\u8303\u3002<\/p>\n<p>\u4e0b\u9762\u4ecb\u7ecd\u4e00\u4e0b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9b\u89c4\u8303\u3002<\/p>\n<h2><strong>\u5206\u652f\u7ba1\u7406\u89c4\u8303<\/strong><\/h2>\n<p>\u5206\u652f\u547d\u540d\u4e0d\u80fd\u5343\u5947\u767e\u602a\uff0c\u5fc5\u987b\u6709\u7edf\u4e00\u7684\u547d\u540d\u65b9\u5f0f\u3002\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>\u5206\u652f\u7ba1\u7406<\/strong><\/th>\n<th><strong>\u547d\u540d\u89c4\u8303<\/strong><\/th>\n<th><strong>\u89e3\u91ca<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>master \u4e3b\u5206\u652f<\/td>\n<td>master<\/td>\n<td>\u7a33\u5b9a\u7248\u672c\u5206\u652f\uff0c\u4e0a\u7ebf\u5b8c\u6210\u56de\u5f52\u540e\u540e\uff0c\u7531\u9879\u76ee\u6280\u672f\u8d1f\u8d23\u4eba\u4ece release \u5206\u652f\u5408\u5e76\u8fdb\u6765\uff0c\u5e76\u6253 tag<\/td>\n<\/tr>\n<tr>\n<td>test \u6d4b\u8bd5\u5206\u652f<\/td>\n<td>test\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0\u793a\u4f8b\uff1atest\/20220426_blog<\/td>\n<td>\u6d4b\u8bd5\u4eba\u5458\u4f7f\u7528\u5206\u652f\uff0c\u6d4b\u8bd5\u65f6\u4ece feature \u5206\u652f\u5408\u5e76\u8fdb\u6765<\/td>\n<\/tr>\n<tr>\n<td>feature \u529f\u80fd\u5f00\u53d1\u5206\u652f<\/td>\n<td>feature\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0_\u8d1f\u8d23\u4eba\u5458\u793a\u4f8b\uff1afeature\/20220426_blog_xiumubai<\/td>\n<td>\u65b0\u529f\u80fd\u5f00\u53d1\u4f7f\u7528\u5206\u652f\uff0c\u57fa\u4e8emaster\u5efa\u7acb<\/td>\n<\/tr>\n<tr>\n<td>fix bug\u4fee\u590d\u5206\u652f<\/td>\n<td>fix\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0_\u8d1f\u8d23\u4eba\u5458\u793a\u4f8b\uff1afix\/20220426_blog_xiumubai<\/td>\n<td>\u7d27\u6025\u7ebf\u4e0abug\u4fee\u590d\u4f7f\u7528\u5206\u652f\uff0c\u57fa\u4e8emaster\u5efa\u7acb<\/td>\n<\/tr>\n<tr>\n<td>release \u4e0a\u7ebf\u5206\u652f<\/td>\n<td>release\/\u7248\u672c\u53f7\u793a\u4f8b\uff1arelease\/0.1.0<\/td>\n<td>\u7528\u4e8e\u4e0a\u7ebf\u7684\u5206\u652f\uff0c\u57fa\u4e8e master \u5efa\u7acb\uff0c\u5fc5\u987b\u5bf9\u8981\u5e76\u5165\u7684 feature \u5206\u652f\u8fdb\u884c Code review \u540e\uff0c\u624d\u53ef\u5e76\u5165\u4e0a\u7ebf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><strong>\u7248\u672c\u53f7\u7ba1\u7406\u89c4\u8303<\/strong><\/h2>\n<p>\u5f53\u6211\u4eec\u4e0a\u7ebf\u7684\u65f6\u5019\uff0c\u9700\u8981\u7ed9\u7248\u672c\u53f7\u6253tag\uff0c\u4e0b\u9762\u662f\u7248\u672c\u53f7\u89c4\u8303\uff1a<\/p>\n<pre>\u9879\u76ee\u4e0a\u7ebfrelease\u5206\u652f\u521b\u5efa\u5b9a\u4e49\uff1a\n&nbsp;&nbsp;\n\u7b2c\u4e00\u4e2a\u6570\u5b57\u662f\u4e3b\u7248\u672c\u3002\u7b2c\u4e8c\u4e2a\u6570\u5b57\u662f\u6b21\u7248\u672c\u3002\u7b2c\u4e09\u4e2a\u6570\u5b57\u662f\u8865\u4e01\u7248\u672c(hotfix&nbsp;\u7c7b\u7684\u66f4\u65b0)\u3002\n\n\u4e3b\u7248\u672c\uff1a\u542b\u6709\u7834\u574f\u6027\u66f4\u65b0\u3001\u5927\u8c03\u6574\u7b49\u3002&nbsp;\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;2.0.0\n\n\u6b21\u7248\u672c\uff1a\u589e\u52a0\u65b0\u529f\u80fd\u7279\u6027\u3002\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;1.2.0\n\n\u8865\u4e01\u7248\u672c\uff1a\u4fee\u590d\u95ee\u9898\u7b49\u3002\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;1.1.1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0b\u56fe\u662f\u4e00\u4e2a\u56f4\u7ed5git\u89c4\u8303\u6765\u7684\u5f00\u53d1\u6d41\u7a0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/156101c574d540bf28900b07b86ab100-0.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe1\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe1\" \/><\/p>\n<h2><strong>\u63d0\u4ea4\u4fe1\u606f\u89c4\u8303<\/strong><\/h2>\n<p>\u6700\u540e\u662fcommit\u7684\u65f6\u5019\uff0c\u9700\u8981\u5bf9commit\u4fe1\u606f\u89c4\u8303\uff0c\u5fc5\u987b\u8981\u52a0\u524d\u7f00<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>\u524d\u7f00<\/strong><\/th>\n<th><strong>\u89e3\u91ca<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>feat<\/td>\n<td>\u65b0\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td>fix<\/td>\n<td>\u4fee\u590d<\/td>\n<\/tr>\n<tr>\n<td>docs<\/td>\n<td>\u6587\u6863\u53d8\u66f4<\/td>\n<\/tr>\n<tr>\n<td>style<\/td>\n<td>\u4ee3\u7801\u683c\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>refactor<\/td>\n<td>\u91cd\u6784<\/td>\n<\/tr>\n<tr>\n<td>perf<\/td>\n<td>\u6027\u80fd\u4f18\u5316<\/td>\n<\/tr>\n<tr>\n<td>test<\/td>\n<td>\u589e\u52a0\u6d4b\u8bd5<\/td>\n<\/tr>\n<tr>\n<td>revert<\/td>\n<td>\u56de\u9000<\/td>\n<\/tr>\n<tr>\n<td>build<\/td>\n<td>\u6253\u5305<\/td>\n<\/tr>\n<tr>\n<td>chore<\/td>\n<td>\u6784\u5efa\u8fc7\u7a0b\u6216\u8f85\u52a9\u5de5\u5177\u7684\u53d8\u52a8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u56fe\u662fvue3\u6e90\u7801\u7684\u63d0\u4ea4\u4fe1\u606f\u89c4\u8303\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/daf3d43d13f3f195333b73c4ceca5b8a-1.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe2\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe2\" \/><\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u5c31\u5b9e\u9645\u64cd\u4f5c\u4e00\u4e0b\uff0c\u5982\u679c\u901a\u8fc7husky+commitlint\u96c6\u6210\u4e00\u4e2a\u7edf\u4e00\u89c4\u8303\u7684git commit\u4fe1\u606f\u3002<\/p>\n<h2><strong>\u914d\u7f6e git \u63d0\u4ea4\u7684\u6821\u9a8c\u94a9\u5b50<\/strong><\/h2>\n<ul>\n<li>husky: git\u63d0\u4ea4\u65f6\u89e6\u53d1hooks<\/li>\n<li>commitlint: \u5bf9\u63d0\u4ea4\u7684\u5185\u5bb9\u505a\u89c4\u8303\u6821\u9a8c husky\uff0c\u4e3b\u8981\u5bf9pre-commit\u548ccommit-msg\u94a9\u5b50\u505a\u6821\u9a8c\u3002<\/li>\n<\/ul>\n<pre>#&nbsp;\u5b89\u88c5husky\nyarn&nbsp;add&nbsp;husky&nbsp;-D\n#&nbsp;\u521d\u59cb\u5316husky\u914d\u7f6e\uff0c\u5728\u6839\u76ee\u5f55\u65b0\u589e.husky\u914d\u7f6e\u6587\u4ef6\u3002\u521d\u59cb\u5316\u914d\u7f6epre-commit\nnpx&nbsp;husky-init&nbsp;\n#&nbsp;\u53e6\u5916\u65b0\u589e\u4e00\u4e2ahooks\uff0ccommit-msg\nnpx&nbsp;husky&nbsp;add&nbsp;.husky\/commit-msg<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u76ee\u5f55\u7ed3\u6784\u662f\u4e0b\u9762\u8fd9\u6837\u5b50\u7684\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/cc004594417c92b156cbb8ab265b3f02-2.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe3\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe3\" \/><\/p>\n<p>\u5728commit-msg\u6587\u4ef6\u4e2d\u6dfb\u52a0 npm run commitlint<\/p>\n<p>\u5728pre-commit\u6587\u4ef6\u4e2d\u6709\u4e2anpm run test\u6211\u4eec\u5148\u6ce8\u91ca\u6389\uff0c\u4e0d\u7136\u4f1a\u62a5\u9519\u3002<\/p>\n<h2><strong>\u5b89\u88c5commitlint<\/strong><\/h2>\n<pre>#&nbsp;\u6dfb\u52a0\u4f9d\u8d56\u6587\u4ef6\nyarn&nbsp;add&nbsp;@commitlint\/config-conventional&nbsp;@commitlint\/cli&nbsp;-D<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6\uff0c\u65b0\u5efacommitlint.config.js\uff0c\u7136\u540e\u6dfb\u52a0\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n<pre>module.exports&nbsp;=&nbsp;{\n&nbsp;&nbsp;extends:&nbsp;['@commitlint\/config-conventional'],\n&nbsp;&nbsp;\/\/&nbsp;\u6821\u9a8c\u89c4\u5219\n&nbsp;&nbsp;rules:&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;'type-enum':&nbsp;[\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'always',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'feat',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'fix',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'docs',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'style',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'refactor',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'perf',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'test',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'chore',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'revert',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'build',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],\n&nbsp;&nbsp;&nbsp;&nbsp;],\n&nbsp;&nbsp;&nbsp;&nbsp;'type-case':&nbsp;[0],\n&nbsp;&nbsp;&nbsp;&nbsp;'type-empty':&nbsp;[0],\n&nbsp;&nbsp;&nbsp;&nbsp;'scope-empty':&nbsp;[0],\n&nbsp;&nbsp;&nbsp;&nbsp;'scope-case':&nbsp;[0],\n&nbsp;&nbsp;&nbsp;&nbsp;'subject-full-stop':&nbsp;[0,&nbsp;'never'],\n&nbsp;&nbsp;&nbsp;&nbsp;'subject-case':&nbsp;[0,&nbsp;'never'],\n&nbsp;&nbsp;&nbsp;&nbsp;'header-max-length':&nbsp;[0,&nbsp;'always',&nbsp;72],\n&nbsp;&nbsp;},\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2><strong>\u914d\u7f6escripts<\/strong><\/h2>\n<p>\u56e0\u4e3a\u6211\u4eec\u9700\u8981\u8fd0\u884cnpm run commitlint\uff0c\u6240\u4ee5\u9700\u8981\u5728package.json\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>#&nbsp;\u5728scrips\u4e2d\u6dfb\u52a0\u4e0b\u9762\u7684\u4ee3\u7801\n{\n\"scripts\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"commitlint\":&nbsp;\"commitlint&nbsp;--config&nbsp;commitlint.config.js&nbsp;-e&nbsp;-V\"\n&nbsp;&nbsp;},\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u914d\u7f6e\u7ed3\u675f\uff0c\u73b0\u5728\u5f53\u6211\u4eec\u586b\u5199commit\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u524d\u9762\u5c31\u9700\u8981\u5e26\u7740\u4e0b\u9762\u7684subject<\/p>\n<pre>'feat',\n'fix',\n'docs',\n'style',\n'refactor',\n'perf',\n'test',\n'chore',\n'revert',\n'build',<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6bd4\u5982\uff1agit commit -m &#8220;feat: test&#8221;,\u6ce8\u610ffeat:\u540e\u9762\u6709\u4e2a\u7a7a\u683c<\/p>\n<p>\u6211\u4eec\u6765\u5199\u4e00\u4e2a\u9519\u8bef\u7684\u6765\u6d4b\u8bd5\u4e00\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/8a072032acc211743bc48ed9f81e48ae-3.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe4\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe4\" \/><\/p>\n<p>\u63d0\u793asubject\u662f\u7a7a\u7684\u3002<\/p>\n<p>\u4f7f\u7528\u6b63\u786e\u7684\u63d0\u4ea4\u65b9\u5f0f\uff0c\u63d0\u4ea4\u6210\u529f\u4e86<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/37d017f2fc5ca6bdc0186c88a1e11ea2-4.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe5\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe5\" \/><\/p>\n<h2><strong>\u4f7f\u7528 commitizen \u505agit\u89c4\u8303\u5316\u63d0\u4ea4<\/strong><\/h2>\n<p>\u7531\u4e8e\u6dfb\u52a0\u4e86commitlint\u9a8c\u8bc1\uff0c\u5bf9\u4e8e\u4e0d\u719f\u6089\u63d0\u4ea4\u89c4\u8303\u7684\u65b0\u624b\u540c\u5b66\u4f1a\u6709\u4e00\u5b9a\u5f71\u54cd\uff0c\u53ef\u4ee5\u6dfb\u52a0 commitizen \u5de5\u5177\uff0c\u624b\u52a8\u751f\u6210\u89c4\u8303\u5316commit\u3002<\/p>\n<p>Commitizen\u662f\u4e00\u4e2a\u683c\u5f0f\u5316commit message\u7684\u5de5\u5177\u3002<\/p>\n<pre>#&nbsp;\u5de5\u5177\u5b89\u88c5\nyarn&nbsp;add&nbsp;-D&nbsp;commitizen<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3><strong>\u4f7f\u7528cz-conventional-changelog<\/strong><\/h3>\n<p>\u5b89\u88c5\u5de5\u5177<\/p>\n<pre>yarn&nbsp;add&nbsp;cz-conventional-changelog&nbsp;-D<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u914d\u7f6e\u547d\u4ee4<\/p>\n<pre>\"script\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"commit\":&nbsp;\"cz\"\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728package.json \u4e2d\u6dfb\u52a0\u5b9a\u4e49commitizen\u4f7f\u7528\u89c4\u5219\uff0c<\/p>\n<pre>{\n\t\"config\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"commitizen\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"path\":&nbsp;\".\/node_modules\/cz-conventional-changelog\"\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;},\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u6267\u884cgit commit\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u63d0\u793a\u6211\u4eec\u586b\u5199\u4ee3\u7801\u89c4\u5219\u4e86<\/p>\n<h3><strong>\u81ea\u5b9a\u4e49 commitizen \u89c4\u5219<\/strong><\/h3>\n<p>\u4f7f\u7528 cz-customizable \u5de5\u5177<\/p>\n<pre>#&nbsp;\u5b89\u88c5\u4f9d\u8d56\nyarn&nbsp;add&nbsp;cz-customizable&nbsp;-D<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u914d\u7f6e\u547d\u4ee4<\/p>\n<pre>\"script\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"commit\":&nbsp;\"git-cz\"\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728package.json \u4e2d\u6dfb\u52a0\u81ea\u5b9a\u4e49commitizen\uff0c\u4f7f\u7528git-cz\u6267\u884cgit commit\u547d\u4ee4<\/p>\n<pre>\"config\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"commitizen\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"path\":&nbsp;\".\/node_modules\/cz-customizable\"\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u6839\u76ee\u5f55\u521b\u5efa\u7684.cz-config.js, \u81ea\u5b9a\u4e49commit\u63d0\u793a\u5185\u5bb9<\/p>\n<pre>module.exports&nbsp;=&nbsp;{\n&nbsp;&nbsp;types:&nbsp;[\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'feat',&nbsp;name:&nbsp;'feat:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b0\u529f\u80fd'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'fix',&nbsp;name:&nbsp;'?fix:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4fee\u590d'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'docs',&nbsp;name:&nbsp;'\ufe0fdocs:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6587\u6863\u53d8\u66f4'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'style',&nbsp;name:&nbsp;'?style:&nbsp;&nbsp;&nbsp;&nbsp;\u4ee3\u7801\u683c\u5f0f(\u4e0d\u5f71\u54cd\u4ee3\u7801\u8fd0\u884c\u7684\u53d8\u52a8)'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value:&nbsp;'refactor',\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;'\ufe0frefactor:&nbsp;\u91cd\u6784(\u65e2\u4e0d\u662f\u589e\u52a0feature\uff0c\u4e5f\u4e0d\u662f\u4fee\u590dbug)'\n&nbsp;&nbsp;&nbsp;&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'perf',&nbsp;name:&nbsp;'\ufe0fperf:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6027\u80fd\u4f18\u5316'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'test',&nbsp;name:&nbsp;'test:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u589e\u52a0\u6d4b\u8bd5'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'chore',&nbsp;name:&nbsp;'?chore:&nbsp;&nbsp;&nbsp;&nbsp;\u6784\u5efa\u8fc7\u7a0b\u6216\u8f85\u52a9\u5de5\u5177\u7684\u53d8\u52a8'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'revert',&nbsp;name:&nbsp;'\u23ea\ufe0frevert:&nbsp;&nbsp;&nbsp;\u56de\u9000'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'build',&nbsp;name:&nbsp;'?\ufe0fbuild:&nbsp;&nbsp;&nbsp;&nbsp;\u6253\u5305'&nbsp;},\n&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;value:&nbsp;'ci',&nbsp;name:&nbsp;'?CI:&nbsp;&nbsp;&nbsp;related&nbsp;changes'&nbsp;}\n&nbsp;&nbsp;],\n&nbsp;&nbsp;\/\/&nbsp;override&nbsp;the&nbsp;messages,&nbsp;defaults&nbsp;are&nbsp;as&nbsp;follows\n&nbsp;&nbsp;messages:&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;'\u8bf7\u9009\u62e9\u63d0\u4ea4\u7c7b\u578b(\u5fc5\u9009):',\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;scope:&nbsp;'\u8bf7\u8f93\u5165\u6587\u4ef6\u4fee\u6539\u8303\u56f4(\u53ef\u9009):',\n&nbsp;&nbsp;&nbsp;&nbsp;customScope:&nbsp;'\u8bf7\u8f93\u5165\u4fee\u6539\u8303\u56f4(\u53ef\u9009):',\n&nbsp;&nbsp;&nbsp;&nbsp;subject:&nbsp;'\u8bf7\u7b80\u8981\u63cf\u8ff0\u63d0\u4ea4(\u5fc5\u586b):',\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;body:&nbsp;'\u8bf7\u8f93\u5165\u8be6\u7ec6\u63cf\u8ff0(\u53ef\u9009\uff0c\u5f85\u4f18\u5316\u53bb\u9664\uff0c\u8df3\u8fc7\u5373\u53ef):',\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;breaking:&nbsp;'List&nbsp;any&nbsp;BREAKING&nbsp;CHANGES&nbsp;(optional):\n',\n&nbsp;&nbsp;&nbsp;&nbsp;footer:&nbsp;'\u8bf7\u8f93\u5165\u8981\u5173\u95ed\u7684issue(\u5f85\u4f18\u5316\u53bb\u9664\uff0c\u8df3\u8fc7\u5373\u53ef):',\n&nbsp;&nbsp;&nbsp;&nbsp;confirmCommit:&nbsp;'\u786e\u8ba4\u4f7f\u7528\u4ee5\u4e0a\u4fe1\u606f\u63d0\u4ea4\uff1f(y\/n\/e\/h)'\n&nbsp;&nbsp;},\n&nbsp;&nbsp;\/\/&nbsp;used&nbsp;if&nbsp;allowCustomScopes&nbsp;is&nbsp;true\n&nbsp;&nbsp;allowCustomScopes:&nbsp;true,\n&nbsp;&nbsp;\/\/&nbsp;allowBreakingChanges:&nbsp;['feat',&nbsp;'fix'],\n&nbsp;&nbsp;skipQuestions:&nbsp;['body',&nbsp;'footer'],\n&nbsp;&nbsp;\/\/&nbsp;limit&nbsp;subject&nbsp;length,&nbsp;commitlint\u9ed8\u8ba4\u662f72\n&nbsp;&nbsp;subjectLimit:&nbsp;72\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u6211\u4eec\u63d0\u4ea4\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u9700\u8981\u5148git add .\uff0c\u7136\u540e\u6267\u884cnpm run commit,\u5c31\u53ef\u4ee5\u6839\u636e\u54cd\u5e94\u7684\u63d0\u793a\u586b\u5199commit\u4fe1\u606f \u4e86\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/37d017f2fc5ca6bdc0186c88a1e11ea2-5.png\" class=\"aligncenter\" title=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe6\" alt=\"Gitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9bgit\u89c4\u8303\u63d2\u56fe6\" \/><\/p>\n<p>\uff08\u5b66\u4e60\u89c6\u9891\u5206\u4eab\uff1a\uff09<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fGitlab\u5b66\u4e60\u4e4b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9b\u89c4\u8303\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fd7\u8bdd\u8bf4\uff0c\u6ca1\u6709\u89c4\u77e9\u4e0d\u6210\u65b9\u5706\uff0c\u6211\u4eec\u7684\u4e5f\u9700\u8981\u89c4\u8303\u3002 \u4e0b\u9762\u4ecb\u7ecd\u4e00\u4e0b\u4f01\u4e1a\u5e38\u7528\u7684\u4e00\u4e9b\u89c4\u8303\u3002 \u5206\u652f\u7ba1\u7406\u89c4\u8303 \u5206\u652f\u547d\u540d\u4e0d\u80fd\u5343\u5947\u767e\u602a\uff0c\u5fc5\u987b\u6709\u7edf\u4e00\u7684\u547d\u540d\u65b9\u5f0f\u3002\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a \u5206\u652f\u7ba1\u7406 \u547d\u540d\u89c4\u8303 \u89e3\u91ca master \u4e3b\u5206\u652f master \u7a33\u5b9a\u7248\u672c\u5206\u652f\uff0c\u4e0a\u7ebf\u5b8c\u6210\u56de\u5f52\u540e\u540e\uff0c\u7531\u9879\u76ee\u6280\u672f\u8d1f\u8d23\u4eba\u4ece release \u5206\u652f\u5408\u5e76\u8fdb\u6765\uff0c\u5e76\u6253 tag test \u6d4b\u8bd5\u5206\u652f test\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0\u793a\u4f8b\uff1atest\/20220426_blog \u6d4b\u8bd5\u4eba\u5458\u4f7f\u7528\u5206\u652f\uff0c\u6d4b\u8bd5\u65f6\u4ece feature \u5206\u652f\u5408\u5e76\u8fdb\u6765 feature \u529f\u80fd\u5f00\u53d1\u5206\u652f feature\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0_\u8d1f\u8d23\u4eba\u5458\u793a\u4f8b\uff1afeature\/20220426_blog_xiumubai \u65b0\u529f\u80fd\u5f00\u53d1\u4f7f\u7528\u5206\u652f\uff0c\u57fa\u4e8emaster\u5efa\u7acb fix bug\u4fee\u590d\u5206\u652f fix\/yyyyMMdd_ \u529f\u80fd\u540d\u79f0_\u8d1f\u8d23\u4eba\u5458\u793a\u4f8b\uff1afix\/20220426_blog_xiumubai \u7d27\u6025\u7ebf\u4e0abug\u4fee\u590d\u4f7f\u7528\u5206\u652f\uff0c\u57fa\u4e8emaster\u5efa\u7acb release \u4e0a\u7ebf\u5206\u652f release\/\u7248\u672c\u53f7\u793a\u4f8b\uff1arelease\/0.1.0 \u7528\u4e8e\u4e0a\u7ebf\u7684\u5206\u652f\uff0c\u57fa\u4e8e master \u5efa\u7acb\uff0c\u5fc5\u987b\u5bf9\u8981\u5e76\u5165\u7684 feature \u5206\u652f\u8fdb\u884c Code review \u540e\uff0c\u624d\u53ef\u5e76\u5165\u4e0a\u7ebf \u7248\u672c\u53f7\u7ba1\u7406\u89c4\u8303 \u5f53\u6211\u4eec\u4e0a\u7ebf\u7684\u65f6\u5019\uff0c\u9700\u8981\u7ed9\u7248\u672c\u53f7\u6253tag\uff0c\u4e0b\u9762\u662f\u7248\u672c\u53f7\u89c4\u8303\uff1a \u9879\u76ee\u4e0a\u7ebfrelease\u5206\u652f\u521b\u5efa\u5b9a\u4e49\uff1a &nbsp;&nbsp; \u7b2c\u4e00\u4e2a\u6570\u5b57\u662f\u4e3b\u7248\u672c\u3002\u7b2c\u4e8c\u4e2a\u6570\u5b57\u662f\u6b21\u7248\u672c\u3002\u7b2c\u4e09\u4e2a\u6570\u5b57\u662f\u8865\u4e01\u7248\u672c(hotfix&nbsp;\u7c7b\u7684\u66f4\u65b0)\u3002 \u4e3b\u7248\u672c\uff1a\u542b\u6709\u7834\u574f\u6027\u66f4\u65b0\u3001\u5927\u8c03\u6574\u7b49\u3002&nbsp;\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;2.0.0 \u6b21\u7248\u672c\uff1a\u589e\u52a0\u65b0\u529f\u80fd\u7279\u6027\u3002\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;1.2.0 \u8865\u4e01\u7248\u672c\uff1a\u4fee\u590d\u95ee\u9898\u7b49\u3002\u4f8b\u5982\uff1a1.1.0&nbsp;&amp;gt;&nbsp;1.1.1 \u767b\u5f55\u540e\u590d\u5236 \u4e0b\u56fe\u662f\u4e00\u4e2a\u56f4\u7ed5git\u89c4\u8303\u6765\u7684\u5f00\u53d1\u6d41\u7a0b\u56fe\uff1a \u63d0\u4ea4\u4fe1\u606f\u89c4\u8303 \u6700\u540e\u662fcommit\u7684\u65f6\u5019\uff0c\u9700\u8981\u5bf9commit\u4fe1\u606f\u89c4\u8303\uff0c\u5fc5\u987b\u8981\u52a0\u524d\u7f00 \u524d\u7f00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19006","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19006"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19006\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}