{"id":10007059,"date":"2023-01-10T12:24:59","date_gmt":"2023-01-10T04:24:59","guid":{"rendered":"https:\/\/ityet.com\/?p=10007059"},"modified":"2023-01-10T12:24:59","modified_gmt":"2023-01-10T04:24:59","slug":"git%e6%93%8d%e4%bd%9c%e4%b8%8d%e8%a7%84%e8%8c%83%ef%bc%8c%e6%88%98%e5%8f%8b%e6%8f%90%e5%88%80%e6%9d%a5%e7%9b%b8%e8%a7%81%ef%bc%81","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10007059","title":{"rendered":"Git\u64cd\u4f5c\u4e0d\u89c4\u8303\uff0c\u6218\u53cb\u63d0\u5200\u6765\u76f8\u89c1\uff01"},"content":{"rendered":"<blockquote><p>\u5e74\u7ec8\u5956\u90fd\u6ca1\u4e86\uff0c\u8fd8\u8981\u6263\u6211\u7ee9\u6548\uff0c\u95e8\u90fd\u6ca1\u6709\uff0c\u54c8\u54c8\u3002<\/p><\/blockquote>\n<p>\u8fd9\u6ce2\u9a9aGit\u64cd\u4f5c\u6211\u4e5f\u662f\u7b2c\u4e00\u6b21\u7528\uff0c\u62c5\u5fc3\u95ea\u4e86\u8170\uff0c\u6240\u4ee5\u4e0d\u4ec5\u505a\u4e86\u5907\u4efd\uff0c\u4e5f\u505a\u4e86\u7b14\u8bb0\uff0c\u5206\u4eab\u7ed9\u5927\u5bb6\u3002<\/p>\n<h2>\u95ee\u9898\u63cf\u8ff0<\/h2>\n<p>\u5c0fA\u548c\u6211\u5728\u540c\u65f6\u5f00\u53d1\u4e00\u4e2a\u529f\u80fd\u6a21\u5757\uff0c\u4ed6\u5728\u4f18\u5316\u4e4b\u524d\u7684\u4ee3\u7801\u903b\u8f91\uff0c\u6211\u5728\u5f00\u53d1\u65b0\u529f\u80fd\u3002<\/p>\n<p>\u5c0fA\u5728\u6211\u4e4b\u524d\u628a\u4ee3\u7801\u63d0\u4ea4\u5230\u4e86\u6d4b\u8bd5\u5206\u652f\uff0c\u6211\u60f3\u63d0\u4ea4\u6211\u7684\u65b0\u529f\u80fd\u4ee3\u7801\u5230\u6d4b\u8bd5\u5206\u652f\u65f6\u53d1\u73b0<strong>\u5de8\u591a\u51b2\u7a81<\/strong>\uff0c\u8111\u888b\u77ac\u95f4\u5c31\u70b8\u4e86\uff0cBoom\u4e00\u58f0\u60ca\u96f7\u54cd\u554a\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043289318\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>PS\uff1a\u56e0\u4e3a\u5c0fA\u7684\u9700\u6c42\u4e0d\u6025\uff0c\u4f46\u662f\u6539\u52a8\u5de8\u5927\uff1b\u6211\u7684\u9700\u6c42\u5f88\u6025\uff0c\u9a6c\u4e0a\u8981\u63d0\u6d4b\uff0c\u5426\u5219\u5c31\u5ef6\u671f\u6263\u7ee9\u6548\u4e86\uff0c\u8bf4\u771f\u7684\uff0c\u6211\u7740\u6025\u4e86\uff0c\u54c8\u54c8\u54c8\u3002<\/strong><\/p>\n<h2>\u5206\u6790\u4e00\u4e0b<\/h2>\n<ol>\n<li>\u9996\u5148\u89e3\u51b3\u51b2\u7a81\u6d6a\u8d39\u65f6\u95f4\uff0c\u6211\u7684\u65b0\u529f\u80fd\u4ee3\u7801\u6bcf\u6b21\u63d0\u6d4b\u5230\u6d4b\u8bd5\u5206\u652f\u90fd\u9700\u8981\u89e3\u51b3\u51b2\u7a81\u3002<\/li>\n<li>\u6211\u5728\u6d4b\u8bd5\u5206\u652f\u89e3\u51b3\u51b2\u7a81\uff0c\u53ea\u80fd\u6309\u7167\u5c0fA\u4f18\u5316\u540e\u7684\u4ee3\u7801\u903b\u8f91\u7684\u53bb\u89e3\u51b3\uff0c\u548c\u6211\u81ea\u5df1\u7684\u5206\u652f\u903b\u8f91\u5e76\u4e0d\u4e00\u81f4\u3002<\/li>\n<li>\u4ea4\u4ed8\u7ed9\u6d4b\u8bd5\u540c\u5b66\u7684\u6d4b\u8bd5\u5206\u652f\u4ee3\u7801\uff0c\u548c\u6211\u81ea\u5df1\u5206\u652f\u7684\u4ee3\u7801\u4e0d\u4e00\u81f4\uff0c\u8fd9\u79cd\u6d4b\u8bd5\u662f\u6ca1\u6709\u610f\u4e49\u7684\u3002<\/li>\n<\/ol>\n<h2>\u53cd\u601d\u51fa\u95ee\u9898\u7684\u539f\u56e0<\/h2>\n<ol>\n<li>\u5de5\u5382\u6a21\u5f0f\u4f7f\u7528\u7684\u4e0d\u5408\u7406<\/li>\n<li>\u4efb\u52a1\u5206\u914d\u7684\u4e0d\u5408\u7406<\/li>\n<\/ol>\n<h3>\u4ee3\u7801\u5c42\u9762<\/h3>\n<p><em>TIPS:\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\u8bed\u8a00\u4e3aGo<\/em><\/p>\n<p>\u56e0\u4e3a\u662f\u5de5\u5382\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u6211\u8d1f\u8d23\u7684\u5b9e\u73b0\u7c7bA\u548c\u4ed6\u7684\u5b9e\u73b0\u7c7bB\u867d\u7136\u6ca1\u6709\u76f4\u63a5\u5173\u7cfb\u3002\u4f46\u662f\u56e0\u4e3a\u4ed6\u4fee\u6539\u4e86\u5de5\u5382\u7c7b\u4e2d\u7684\u65b9\u6cd5\u5b9a\u4e49\u3002<\/p>\n<p>\u6bd4\u5982\u4e4b\u524d\u5de5\u5382\u7c7b\u4e2d\u7684\u63a5\u53e3\u662f\u8fd9\u4e48\u5b9a\u4e49\u7684<\/p>\n<pre><code class=\"go\">package factory\n\ntype xxx interface {\n   GetXxxx(ctx context.Context, req aaa.aa) (res bbb.bb, err error)  \n}<\/code><\/pre>\n<p>\u4f46\u662f\u5c0fA\u4f18\u5316(\u4fee\u6539)\u4e86\u5de5\u5382\u7c7b\u4e2d\u7684\u63a5\u53e3\u5b9a\u4e49\uff1a<\/p>\n<pre><code class=\"go\">package factory\n\ntype xxx interface {\n   GetXxxx(ctx context.Context, req ccc.cc) (res ddd.dd, err error)  \n}<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u5bfc\u81f4\u4e86\u4e00\u4e2a\u95ee\u9898\uff1a<\/p>\n<p>\u6211\u60f3\u5408\u5e76\u6211\u7684\u4ee3\u7801\u5230\u6d4b\u8bd5\u5206\u652f\u4e5f\u5fc5\u987b\u5c06\u6211\u7684\u5b9e\u73b0\u7c7b\u50cf\u5c0fA\u4e00\u6837\uff0c\u4fee\u6539\u4f20\u53c2\u7c7b\u578b\u548c\u8fd4\u56de\u7c7b\u578b\u3002<\/p>\n<p>\u4f46\u662f\u6211\u4eec\u90fd\u5728\u4e0d\u540c\u7684\u5206\u652f\u4e0a\u5f00\u53d1\uff0c\u6211\u662f\u6ca1\u6709\u4ed6\u5b9a\u4e49\u7684\u7c7b\u578b<code>ccc.cc<\/code>,<code>ddd.dd<\/code>\u7684\u3002<\/p>\n<p>\u6211\u53c8\u4e0d\u80fd\u76f4\u63a5\u628a\u4ed6\u5b9a\u4e49\u7684<code>ccc.cc<\/code>,<code>ddd.dd<\/code>\u8981\u8fc7\u6765\uff0c\u5728\u6211\u81ea\u5df1\u7684\u5206\u652f\u4e0a\u5f00\u53d1\uff0c\u4e00\u662f\u56e0\u4e3a\u9700\u6c42\u4e0d\u4e00\u81f4\uff0c\u5c0fA\u7684\u4e0a\u7ebf\u5468\u671f\u4f1a\u6bd4\u6211\u957f\uff1b\u4e8c\u662f\u8fd9\u79cd\u64cd\u4f5c\u672c\u8eab\u5c31\u4e0d\u89c4\u8303\u3002<\/p>\n<h2>\u89e3\u51b3\u95ee\u9898<\/h2>\n<h3>1.\u4ee3\u7801\u5c42\u9762\uff1a<\/h3>\n<p>\u6211\u4eec\u60f3\u5230\u7684\u65b9\u6848\u662f\u5408\u7406\u4f7f\u7528interface<\/p>\n<p>\u5de5\u5382\u7c7b\u4e2d\u65b9\u6cd5\u7684\u5165\u53c2\u548c\u51fa\u53c2\u8bbe\u7f6e\u4e3a<code>interface{}<\/code>\u7c7b\u578b<\/p>\n<pre><code class=\"go\">package factory\n\ntype xxx interface {\n   GetXxxx(ctx context.Context, req interface{}) (res interface{}, err error)  \n}<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u6bd4\u8f83\u5bb9\u6613\u8fdb\u884c\u6269\u5c55\u4e86\u3002<\/p>\n<h3>2.Git\u5c42\u9762\uff1a<\/h3>\n<p>\u65b9\u6cd51\u7684\u5165\u53c2\u548c\u51fa\u53c2\u8bbe\u7f6e\u4e3a<code>interface{}<\/code>\u7c7b\u578b\u7684\u65b9\u6848\uff0c\u5e76\u6ca1\u6709\u4ece\u6839\u672c\u4e0a\u89e3\u51b3\u6211\u4eec\u7684\u95ee\u9898\u3002<\/p>\n<p>\u539f\u56e0\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<p>\u5c0fA\u7684\u9700\u6c42\u662f\u6574\u4f53\u4f18\u5316\u5de5\u5382\u7c7b\u548c\u5404\u4e2a\u5b9e\u73b0\u7c7b\u7684\u5165\u53c2\u3001\u51fa\u53c2\uff0c\u4f18\u5316\u5185\u90e8\u903b\u8f91\uff0c\u62bd\u53d6\u65b9\u6cd5\u3002<\/p>\n<p>\u5c0fA\u7684\u8fed\u4ee3\u4f18\u5316\u4fee\u6539\u53d8\u52a8\u5f88\u5927\uff0c\u5bfc\u81f4\u548c\u6211\u5b9e\u73b0\u7684\u65b0\u9700\u6c42\u6709\u6bd4\u8f83\u5927\u7684\u51b2\u7a81\u3002<\/p>\n<p>\u4f46\u662f\u4ed6\u7684Git\u5206\u652f\u53c8\u5728\u6211\u4e4b\u524d\u63d0\u4ea4\u5230\u4e86\u6d4b\u8bd5\u73af\u5883\uff0c\u5bfc\u81f4\u6211\u65e0\u6cd5\u6b63\u5e38\u63d0\u4ea4\u6211\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u5982\u679c\u6211\u8981\u63d0\u4ea4\u5c31\u8981\u89e3\u51b3\u5404\u79cd\u51b2\u7a81\uff0c\u89e3\u51b3\u51b2\u7a81\u5c31\u8981\u6309\u7167\u5c0fA\u7684\u4f18\u5316\u903b\u8f91\u53bb\u6539\uff0c\u63d0\u6d4b\u5206\u652f\u548c\u6211\u81ea\u5df1\u5206\u652f\u7684\u4e0d\u4e00\u81f4\uff0c\u96be\u9876\u554a\u3002<\/p>\n<p>\u8003\u8651\u5230\u5c0fA\u7684\u4fee\u6539\u6682\u65f6\u4e0d\u9700\u8981\u63d0\u6d4b\uff0c\u4e0a\u7ebf\u5468\u671f\u4e5f\u6bd4\u8f83\u957f\u3002<\/p>\n<h3>\u6700\u7ec8\u65b9\u6848\uff1a<\/h3>\n<p>\u6700\u7ec8\u7684\u89e3\u51b3\u65b9\u6848\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<ol>\n<li>\u4ece\u8fdc\u7a0b\u7684\u6d4b\u8bd5\u5206\u652f\u62c9\u53d6\u4e86\u4e00\u4e2a\u5907\u4efd\u5206\u652f\uff0c\u5220\u9664\u5c0fA\u63d0\u4ea4\u7684\u8fdc\u7a0b\u6d4b\u8bd5\u5206\u652f<\/li>\n<li>\u628a\u6211\u672c\u5730\u9700\u8981\u6d4b\u8bd5\u7684\u5206\u652f\u63d0\u4ea4\u5230\u6d4b\u8bd5\u5206\u652f\uff0c\u4ea4\u4ed8\u6d4b\u8bd5\uff08\u56e0\u4e3a\u6211\u7684\u9700\u6c42\u5f88\u6025\uff0c\u800c\u5c0fA\u7684\u9700\u6c42\u5e76\u4e0d\u6025\uff09<\/li>\n<\/ol>\n<h2>\u76f8\u5173\u547d\u4ee4<\/h2>\n<p>\u8fd9\u6ce2\u9a9a\u64cd\u4f5c\u6211\u4e5f\u662f\u7b2c\u4e00\u6b21\u7528\uff0c\u62c5\u5fc3\u95ea\u4e86\u8170\uff0c\u6240\u4ee5\u4e0d\u4ec5\u505a\u4e86\u5907\u4efd\uff0c\u4e5f\u505a\u4e86\u7b14\u8bb0\uff0c\u5206\u4eab\u7ed9\u5927\u5bb6\uff1a<\/p>\n<h3>Git \u91cd\u547d\u540d\u8fdc\u7a0b\u5206\u652f<\/h3>\n<p>1.\u5148\u91cd\u547d\u540d\u672c\u5730\u5206\u652f<\/p>\n<pre><code class=\"shell\">git branch -m \u65e7\u5206\u652f\u540d\u79f0  \u65b0\u5206\u652f\u540d\u79f0<\/code><\/pre>\n<p>2.\u5220\u9664\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre><code class=\"shell\">git push --delete origin \u65e7\u5206\u652f\u540d\u79f0<\/code><\/pre>\n<p>3.\u4e0a\u4f20\u65b0\u4fee\u6539\u540d\u79f0\u7684\u672c\u5730\u5206\u652f<\/p>\n<pre><code class=\"shell\">git push origin \u65b0\u5206\u652f\u540d\u79f0<\/code><\/pre>\n<p>4.\u4fee\u6539\u540e\u7684\u672c\u5730\u5206\u652f\u5173\u8054\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre><code class=\"shell\">git branch --set-upstream-to origin\/\u65b0\u5206\u652f\u540d\u79f0<\/code><\/pre>\n<h2>\u63a8\u8350\u9605\u8bfb<\/h2>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=Ax3Sq%2FNzWoGyBroxjRFIHQ%3D%3D.bR14ISRrXGqd0rM7oT4rE9ivyAbXVmH8UYl08mj8aPkC8pmeugdBZCcfbC1DvcXkCz8WSj9hXanbtEOltiiwvj8HjKJWHi2JTys5%2F9dIIGlngvH%2BHJR0Srq2dhm2SC2VclsTvcfH9ViiHxH4NtxO4k9mhTQogAIANXpebN1f5ZEF9Ggq%2BFpXMe2FsztrfotyvYIo6MS15b6q5eMxh9NHo4KOgMxUbNF24N2I11%2BXSD0EJre2dzJUf0lIc9xqugzfXwQQg0LNNx19WPt9x%2FpcX4TCmg1%2BSTgOiYUxCCDNLek%3D\" rel=\"nofollow\">\u3010Git\u5fc5\u77e5\u5fc5\u4f1a\u3011\u591a\u4eba\u534f\u540c\u5f00\u53d1\uff0c\u7d27\u6025\u4fee\u590d\u7ebf\u4e0abug\u7684\u64cd\u4f5c\u6307\u5357\u3002<\/a><\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u5f00\u53d1\u8d77\u6765\u4e00\u65f6\u723d\uff0c\u7ef4\u62a4\u8d77\u6765\u706b\u846c\u573a\u3002<\/p>\n<p>Git\u64cd\u4f5c\u4e0d\u89c4\u8303\uff0c\u6218\u53cb\u63d0\u5200\u6765\u76f8\u89c1\uff01<\/p>\n<p><strong>\u547c\u5e94\u4e00\u4e0b\u5f00\u7bc7\uff0c\u8fd9\u662f\u4e34\u65f6\u89e3\u51b3\u529e\u6cd5\u7684\u4e00\u4e2a\u7ecf\u9a8c\u5206\u4eab\u3002\u80af\u5b9a\u8fd8\u6709\u6700\u4f18\u89e3\uff0c\u4f46\u662f\u5bf9\u6211\u6765\u8bf4\u4e0d\u91cd\u8981\uff0c\u518d\u4e0d\u4f7f\u7528\u9a9a\u64cd\u4f5c\u5c31\u8be5\u6263\u7ee9\u6548\u4e86\u3002<\/strong><\/p>\n<blockquote><p>\u5e74\u7ec8\u5956\u90fd\u6ca1\u4e86\uff0c\u8fd8\u8981\u6263\u6211\u7ee9\u6548\uff0c\u95e8\u90fd\u6ca1\u6709\uff0c\u54c8\u54c8\u3002<\/p><\/blockquote>\n<p>\u4f60\u7684\u5e74\u7ec8\u5956\u8fd8\u597d\u5417\uff0c\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u8ba8\u8bba\u3002<\/p>\n<h2>\u4e00\u8d77\u8fdb\u6b65<\/h2>\n<p>\u5982\u679c\u4f60\u89c9\u5f97\u8fd9\u7bc7\u6587\u7ae0\u4e0d\u9519\uff0c\u6b22\u8fce\u70b9\u8d5e\uff0c\u8bc4\u8bba\u3002<\/p>\n<p>\u6211\u7684\u601d\u5426\u58f0\u671b\u4ec0\u4e48\u65f6\u5019\u80fd\u5230100\u5440\uff01\uff1f<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043289315\">https:\/\/segmentfault.com\/a\/1190000043289315<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e74\u7ec8\u5956\u90fd\u6ca1\u4e86\uff0c\u8fd8\u8981\u6263\u6211\u7ee9\u6548\uff0c\u95e8\u90fd\u6ca1\u6709\uff0c\u54c8\u54c8\u3002 \u8fd9\u6ce2\u9a9aGit\u64cd\u4f5c\u6211\u4e5f\u662f\u7b2c\u4e00\u6b21\u7528\uff0c\u62c5\u5fc3\u95ea\u4e86\u8170\uff0c\u6240\u4ee5\u4e0d\u4ec5\u505a\u4e86\u5907\u4efd\uff0c\u4e5f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10007059","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10007059"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007059\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10007059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10007059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10007059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}