{"id":4048,"date":"2022-09-30T22:28:19","date_gmt":"2022-09-30T14:28:19","guid":{"rendered":"https:\/\/aiwellbore.com\/?p=4048"},"modified":"2022-10-01T02:23:51","modified_gmt":"2022-09-30T18:23:51","slug":"git%e4%bd%bf%e7%94%a8%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/aiwellbore.com\/?p=4048","title":{"rendered":"Git\u4f7f\u7528\u5feb\u901f\u4e0a\u624b\u6307\u5357"},"content":{"rendered":"<h1>Git\u4f7f\u7528\u5feb\u901f\u4e0a\u624b\u6307\u5357<\/h1>\n<h2>1.\u4ec0\u4e48\u662fGit<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled.png\" alt=\"Untitled\" \/><\/p>\n<p>Git\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6709\u6548\u3001\u9ad8\u901f\u5730\u5904\u7406\u4ece\u5f88\u5c0f\u5230\u975e\u5e38\u5927\u7684\u9879\u76ee\u7248\u672c\u7ba1\u7406\u3002\u65b9\u4fbf\u56e2\u961f\u5f00\u53d1\u8005\u6765\u8fdb\u884c\u5408\u4f5c\u5f00\u53d1\u7248\u672c\u540c\u6b65\u4ee5\u53ca\u7248\u672c\u7684\u7ba1\u7406\uff0c\u63d0\u9ad8\u5f00\u53d1\u7684\u6548\u7387\u3002<\/p>\n<h2>2.\u5b89\u88c5Git\u73af\u5883<\/h2>\n<ul>\n<li>\u6253\u5f00git\u5b98\u7f51<\/li>\n<\/ul>\n<pre><code class=\"language-csharp\">https:\/\/git-scm.com\/<\/code><\/pre>\n<ul>\n<li>\u4e0b\u8f7dGit\u5b89\u88c5\u5305<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled-1.png\" alt=\"Untitled\" \/><\/p>\n<ul>\n<li>\u76f4\u63a5\u5b89\u88c5\u5373\u53ef\u3002<\/li>\n<\/ul>\n<h2>3.\u4ee3\u7801\u6258\u7ba1\u7f51\u7ad9\u63a8\u8350<\/h2>\n<p>\u56e0\u4e3aGit\u7684\u4f7f\u7528\u9700\u8981\u7528\u5230\u670d\u52a1\u5668\u6765\u5b9e\u73b0\u591a\u7528\u6237\u7684\u4ee3\u7801\u540c\u6b65\uff0c\u4e3a\u4e86\u4fdd\u8bc1Git\u670d\u52a1\u7684\u9ad8\u6548\u548c\u7a33\u5b9a\u6027\uff0c \u6211\u8fd9\u91cc\u63a8\u8350\u4f7f\u7528\u7b2c\u4e09\u65b9\u7684\u4ee3\u7801\u6258\u7ba1\u7f51\u7ad9\u6765\u4f7f\u7528\uff0c\u9996\u5148\u63a8\u8350\u7684\u662fgithub\uff0c\u4f46\u662f\u9274\u4e8e\u56fd\u5185\u5bf9github\u5f88\u96be\u8bbf\u95ee\uff0c\u8fd9\u91cc\u6211\u5c06\u6559\u5927\u5bb6\u56fd\u5185\u6700\u5927\u7684\u4ee3\u7801\u6258\u7ba1\u7f51\u7ad9gitee\u7684\u4f7f\u7528\u3002<\/p>\n<p>\u9996\u5148\u662fgitee\u7684\u5b98\u7f51\u662f\uff1a<\/p>\n<pre><code class=\"language-csharp\">https:\/\/gitee.com\/<\/code><\/pre>\n<p>\u9996\u5148\u662f\u6ce8\u518c\u8d26\u53f7\uff0c\u6ce8\u518c\u5b8c\u8d26\u53f7\uff0c\u6211\u4eec\u65b0\u5efa\u9879\u76ee\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled-2.png\" alt=\"Untitled\" \/><\/p>\n<p>\u521b\u5efa\u5b8c\u6bd5\u540e\uff0c\u5230\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u6309\u4f4fshift+\u9f20\u6807\u53f3\u952e\uff0c\u70b9\u51fb\u201d\u5728\u6b64\u5904\u6253\u5f00PowerShell\u7a97\u53e3\u201d<\/p>\n<p>\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u4f7f\u7528git\uff0c\u8fd9\u91cc\u9996\u5148\u8981\u5bf9git\u8fdb\u884c\u5168\u5c40\u8bbe\u7f6e\u3002\u4f9d\u6b21\u8f93\u5165\u4ee5\u4e0b\u4e24\u6761\u547d\u4ee4\u5e76\u56de\u8f66\uff1a<\/p>\n<pre><code class=\"language-csharp\">git config --global user.name &quot;\u4f60\u7684\u7528\u6237\u540d&quot;\ngit config --global user.email &quot;\u6ce8\u518c\u7684\u90ae\u7bb1&quot;<\/code><\/pre>\n<p>\u63a5\u7740\u628a\u672c\u5730\u9879\u76ee\u7684\u6587\u4ef6\u5168\u90e8\u4e0a\u4f20\u5230\u6258\u7ba1\u7f51\u7ad9\u91cc\u6b65\u9aa4\u4e3a:<\/p>\n<pre><code class=\"language-csharp\">git add .\ngit commit -m &quot;first commit&quot;\ngit git remote add origin \u4f60\u4ed3\u5e93\u7684\u5730\u5740\ngit push -u origin &quot;master&quot;<\/code><\/pre>\n<p>\u5176\u4e2d\u4f60\u4ed3\u5e93\u7684\u5730\u5740\u5728\u8fd9\u91cc\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled-3.png\" alt=\"Untitled\" \/><\/p>\n<p>\u8fd9\u6837\u6211\u4eec\u7684\u4ee3\u7801\u5c31\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e2d\u4e86\u3002<\/p>\n<h2>3.Git\u65e5\u5e38\u4f7f\u7528\u547d\u4ee4<\/h2>\n<p>\u9996\u5148\u662f\u5f53\u4f60\u5b8c\u6210\u4e86\u4ee3\u7801\u6539\u52a8\u4e4b\u540e\uff0c\u60f3\u8981\u628a\u4f60\u7684\u6539\u52a8\u540e\u7684\u7248\u672c\u540c\u6b65\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u91cc\u5c31\u9700\u8981\u4f7f\u7528\u63d0\u4ea4\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-csharp\">\/\/\u9996\u5148\u662f\u6dfb\u52a0\u53d8\u52a8,\u8fd9\u91cc\u662f\u76f4\u63a5\u628a\u9879\u76ee\u91cc\u6240\u6709\u53d8\u52a8\u5168\u90e8\u6dfb\u52a0\u6682\u5b58\ngit add .\n\/\/\u63a5\u4e0b\u6765\u662f\u63d0\u4ea4\u53d8\u52a8\ngit commit -m &quot; &quot;\n\/\/\u4e0a\u9762\u53cc\u5f15\u53f7\u5185\u9700\u8981\u586b\u5199\u4f60\u5bf9\u4ee3\u7801\u4fee\u6539\u7684\u63cf\u8ff0\u65b9\u4fbf\u4e4b\u540e\u5bf9\u7248\u672c\u8fdb\u884c\u8fa8\u522b\n\/\/\u6700\u540e\u628a\u63d0\u4ea4\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e2d\ngit push -u origin &quot;master&quot;<\/code><\/pre>\n<p>\u8fd9\u6837\u4f60\u5c31\u5b8c\u6210\u4e86\u5bf9\u4ee3\u7801\u4fee\u6539\u7684\u4e0a\u4f20<\/p>\n<p>\u5982\u679c\u4f60\u56e2\u961f\u5176\u4ed6\u4eba\u60f3\u540c\u6b65\u4f60\u5bf9\u4ee3\u7801\u7684\u4fee\u6539\u8be5\u600e\u4e48\u529e\u5462\u53ea\u9700\u8981\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\u5c31\u80fd\u4ece\u670d\u52a1\u5668\u4e2d\u62c9\u53bb\u4f60\u7684\u4fee\u6539\uff1a<\/p>\n<pre><code class=\"language-csharp\">git pull<\/code><\/pre>\n<p>\u8981\u6ce8\u610f\u7684\u4e8b\u60c5\u662f\u4f60\u4eec\u5728\u534f\u4f5c\u7684\u65f6\u5019\u4e0d\u80fd\u540c\u65f6\u5bf9\u4e00\u4e2a\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u8fd9\u6837\u4f1a\u5bfc\u81f4\u7248\u672c\u51b2\u7a81\u65e0\u6cd5\u5408\u5e76\u4ee3\u7801\u3002\u60f3\u8981\u89e3\u51b3\u51b2\u7a81\u53ea\u80fd\u624b\u52a8\u4fee\u6539\u4ee3\u7801\u3002<\/p>\n<p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fVS\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528VS\u81ea\u5e26\u7684Git\u7ba1\u7406\u5de5\u5177\u6765\u8fdb\u884c\u4ee3\u7801\u7684\u63d0\u4ea4\u548c\u62c9\u53d6<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled-4.png\" alt=\"Untitled\" \/><\/p>\n<p>\u9996\u5148\u4f60\u8981\u586b\u5199\u7248\u672c\u4fee\u6539\u4fe1\u606f\uff0c\u7136\u540e\u70b9\u51fb\u5168\u90e8\u63d0\u4ea4\uff0c\u63d0\u4ea4\u4e4b\u540e\u70b9\u51fb\u6700\u4e0a\u65b9\u5411\u4e0a\u7684\u7bad\u5934\u8fdb\u884c\u63a8\u9001\uff0c\u5982\u679c\u60f3\u8981\u540c\u6b65\u4ee3\u7801\u5c31\u70b9\u51fb\u6700\u4e0a\u65b9\u7bad\u5934\u5411\u4e0b\u7684\u6309\u94ae\u8fdb\u884c\u62c9\u53d6\u3002<\/p>\n<h2>4.\u7248\u672c\u56de\u9000<\/h2>\n<p>\u6211\u4eec\u6709\u65f6\u5019\u4f1a\u9047\u5230\u4e00\u4e9b\u65e0\u6cd5\u89e3\u51b3\u7684\u6076\u6027BUG\uff0c\u60f3\u8981\u628a\u4ee3\u7801\u53d8\u56de\u4e0a\u6b21\u53ef\u4ee5\u8fd0\u884c\u6210\u529f\u7684\u72b6\u6001\uff0c\u8fd9\u65f6\u5019\u5c31\u53ef\u4ee5\u7528\u5230git\u7684\u7248\u672c\u56de\u9000\u529f\u80fd\u3002<\/p>\n<p>\u9996\u5148\u6211\u4eec\u8f93\u5165git reflog\u6307\u4ee4\u5c31\u80fd\u770b\u5230\u6211\u4eec\u4e4b\u524d\u63d0\u4ea4\u7684\u6240\u6709\u7248\u672c\uff0c\u9009\u62e9\u4f60\u60f3\u8981\u9000\u56de\u7684\u7248\u672c\u627e\u5230\u5bf9\u5e94\u7684\u7248\u672c\u53f7\uff0c\u7248\u672c\u53f7\u5728\u8fd9\u91cc\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/aiwellbore.com\/wp-content\/uploads\/2022\/09\/Untitled-5.png\" alt=\"Untitled\" \/><\/p>\n<p>\u7136\u540e\u6211\u4eec\u8f93\u5165<\/p>\n<pre><code class=\"language-jsx\">git reset --hard \u7248\u672c\u53f7<\/code><\/pre>\n<p>\u5c31\u80fd\u9000\u56de\u5230\u4f60\u60f3\u9000\u56de\u7684\u7248\u672c\uff0c\u4f46\u662f\u5982\u679c\u4f60\u9000\u56de\u7684\u7248\u672c\u65e9\u4e8e\u4f60\u670d\u52a1\u5668\u91cc\u8fdc\u7a0b\u7684\u7248\u672c\u8fd9\u91cc\u9700\u8981\u5f3a\u5236\u63a8\u9001\u4e00\u4e0b\u6765\u8986\u76d6\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u4ee3\u7801\u8fd9\u6837\u5c31\u8981\u4f7f\u7528git push -f origin master\u3002<\/p>\n<p>\u540c\u65f6\u4f60\u8981\u544a\u8bc9\u4f60\u4ed3\u5e93\u7684\u5176\u4ed6\u6210\u5458\u91cd\u65b0git clone\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u4ee3\u7801\u5230\u672c\u5730\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git\u4f7f\u7528\u5feb\u901f\u4e0a\u624b\u6307\u5357 1.\u4ec0\u4e48\u662fGit Git\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6709\u6548\u3001\u9ad8\u901f\u5730\u5904\u7406\u4ece\u5f88\u5c0f\u5230\u975e&#8230; <\/p>\n","protected":false},"author":1,"featured_media":4047,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-4048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/posts\/4048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4048"}],"version-history":[{"count":5,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/posts\/4048\/revisions"}],"predecessor-version":[{"id":4061,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/posts\/4048\/revisions\/4061"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=\/wp\/v2\/media\/4047"}],"wp:attachment":[{"href":"https:\/\/aiwellbore.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiwellbore.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}