{"id":21573,"date":"2024-11-19T15:00:58","date_gmt":"2024-11-19T07:00:58","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21573\/"},"modified":"2024-11-19T15:00:58","modified_gmt":"2024-11-19T07:00:58","slug":"git%e7%89%88%e6%9c%ac%e5%86%b2%e7%aa%81%e6%80%8e%e4%b9%88%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21573\/","title":{"rendered":"git\u7248\u672c\u51b2\u7a81\u600e\u4e48\u89e3\u51b3"},"content":{"rendered":"<blockquote><p>\n  \u89e3\u51b3 git \u7248\u672c\u51b2\u7a81\uff1a1. \u786e\u5b9a\u51b2\u7a81\u7684\u6587\u4ef6\uff1b2. \u67e5\u770b\u51b2\u7a81\uff1b3. \u624b\u52a8\u5408\u5e76\u66f4\u6539\uff1b4. \u6807\u8bb0\u51b2\u7a81\u5df2\u89e3\u51b3\uff1b5. \u63d0\u4ea4\u5408\u5e76\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/31\/2024053100285644981.jpg\" class=\"aligncenter\" title=\"git\u7248\u672c\u51b2\u7a81\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" alt=\"git\u7248\u672c\u51b2\u7a81\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u89e3\u51b3 Git \u7248\u672c\u51b2\u7a81<\/strong><\/p>\n<p>Git \u7248\u672c\u51b2\u7a81\u53d1\u751f\u5728\u591a\u4e2a\u7528\u6237\u5bf9\u540c\u4e00\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5bfc\u81f4 Git \u65e0\u6cd5\u81ea\u52a8\u5408\u5e76\u8fd9\u4e9b\u66f4\u6539\u65f6\u3002<\/p>\n<p><strong>\u89e3\u51b3\u51b2\u7a81\u7684\u6b65\u9aa4<\/strong>\uff1a<\/p>\n<p><strong>1. \u786e\u5b9a\u51b2\u7a81\u7684\u6587\u4ef6\uff1a<\/strong><br \/>\u4f7f\u7528  status \u547d\u4ee4\uff0c\u627e\u51fa\u5305\u542b\u51b2\u7a81\u7684\u6587\u4ef6\u3002<\/p>\n<p><strong>2. \u67e5\u770b\u51b2\u7a81\uff1a<\/strong><br \/>\u4f7f\u7528 git diff \u547d\u4ee4\uff0c\u6bd4\u8f83\u4fee\u6539\u540e\u7684\u6587\u4ef6\u548c\u5408\u5e76\u540e\u7684\u7248\u672c\u3002<\/p>\n<p><strong>3. \u624b\u52a8\u5408\u5e76\uff1a<\/strong><br \/>\u4f7f\u7528\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\uff0c\u6253\u5f00\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u5e76\u624b\u52a8\u5408\u5e76\u66f4\u6539\u3002\u53ef\u4ee5\u4fdd\u7559\u4e00\u4e2a\u7248\u672c\u7684\u66f4\u6539\uff0c\u62d2\u7edd\u53e6\u4e00\u4e2a\u7248\u672c\u7684\u66f4\u6539\uff0c\u6216\u8005\u5408\u5e76\u4e24\u4e2a\u7248\u672c\u3002<\/p>\n<p><strong>4. \u6807\u8bb0\u51b2\u7a81\u5df2\u89e3\u51b3\uff1a<\/strong><br \/>\u4fdd\u5b58\u5df2\u5408\u5e76\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528 git add \u547d\u4ee4\u5c06\u5176\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002<\/p>\n<p><strong>5. \u63d0\u4ea4\u5408\u5e76\uff1a<\/strong><br \/>\u4f7f\u7528 `git commit -m &#8220;Resolve conflict: [\u7b80\u8ff0 conflict]&#8221; \u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u7684\u66f4\u6539\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u5047\u8bbe\u4e24\u4e2a\u7528\u6237\u5bf9 file.txt \u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5e76\u4e14\u53d1\u751f\u4e86\u51b2\u7a81\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u89e3\u51b3\u51b2\u7a81\uff1a<\/p>\n<ol>\n<li>\u8fd0\u884c git status\uff0c\u53d1\u73b0 file.txt \u5b58\u5728\u51b2\u7a81\u3002<\/li>\n<li>\u8fd0\u884c git diff file.txt\uff0c\u67e5\u770b\u5dee\u5f02\u3002<\/li>\n<li>\n<p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00 file.txt\uff0c\u5e76\u624b\u52a8\u5408\u5e76\u4ee5\u4e0b\u66f4\u6539\uff1a<\/p>\n<ul>\n<li>\u7528\u6237 1 \u6dfb\u52a0\u4e86\u4e00\u884c\u6587\u672c &#8220;Hello world!&#8221;\u3002<\/li>\n<li>\u7528\u6237 2 \u66f4\u6539\u4e86\u53e6\u4e00\u884c\u6587\u672c\u4e3a &#8220;Goodbye world!&#8221;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u66f4\u6539\u540e\u7684\u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n<pre>Hello world!\nGoodbye world!<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u4fdd\u5b58 file.txt\u3002<\/li>\n<li>\u8fd0\u884c git add file.txt\u3002<\/li>\n<li>\u8fd0\u884c git commit -m &#8220;Resolve conflict: Merge Hello world! and Goodbye world!&#8221;\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7248\u672c\u51b2\u7a81\u600e\u4e48\u89e3\u51b3\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>\u89e3\u51b3 git \u7248\u672c\u51b2\u7a81\uff1a1. \u786e\u5b9a\u51b2\u7a81\u7684\u6587\u4ef6\uff1b2. \u67e5\u770b\u51b2\u7a81\uff1b3. \u624b\u52a8\u5408\u5e76\u66f4\u6539\uff1b4. \u6807\u8bb0\u51b2\u7a81\u5df2\u89e3\u51b3\uff1b5. \u63d0\u4ea4\u5408\u5e76\u3002 \u5982\u4f55\u89e3\u51b3 Git \u7248\u672c\u51b2\u7a81 Git \u7248\u672c\u51b2\u7a81\u53d1\u751f\u5728\u591a\u4e2a\u7528\u6237\u5bf9\u540c\u4e00\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5bfc\u81f4 Git \u65e0\u6cd5\u81ea\u52a8\u5408\u5e76\u8fd9\u4e9b\u66f4\u6539\u65f6\u3002 \u89e3\u51b3\u51b2\u7a81\u7684\u6b65\u9aa4\uff1a 1. \u786e\u5b9a\u51b2\u7a81\u7684\u6587\u4ef6\uff1a\u4f7f\u7528 status \u547d\u4ee4\uff0c\u627e\u51fa\u5305\u542b\u51b2\u7a81\u7684\u6587\u4ef6\u3002 2. \u67e5\u770b\u51b2\u7a81\uff1a\u4f7f\u7528 git diff \u547d\u4ee4\uff0c\u6bd4\u8f83\u4fee\u6539\u540e\u7684\u6587\u4ef6\u548c\u5408\u5e76\u540e\u7684\u7248\u672c\u3002 3. \u624b\u52a8\u5408\u5e76\uff1a\u4f7f\u7528\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\uff0c\u6253\u5f00\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u5e76\u624b\u52a8\u5408\u5e76\u66f4\u6539\u3002\u53ef\u4ee5\u4fdd\u7559\u4e00\u4e2a\u7248\u672c\u7684\u66f4\u6539\uff0c\u62d2\u7edd\u53e6\u4e00\u4e2a\u7248\u672c\u7684\u66f4\u6539\uff0c\u6216\u8005\u5408\u5e76\u4e24\u4e2a\u7248\u672c\u3002 4. \u6807\u8bb0\u51b2\u7a81\u5df2\u89e3\u51b3\uff1a\u4fdd\u5b58\u5df2\u5408\u5e76\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528 git add \u547d\u4ee4\u5c06\u5176\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002 5. \u63d0\u4ea4\u5408\u5e76\uff1a\u4f7f\u7528 `git commit -m &#8220;Resolve conflict: [\u7b80\u8ff0 conflict]&#8221; \u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u7684\u66f4\u6539\u3002 \u793a\u4f8b\uff1a \u5047\u8bbe\u4e24\u4e2a\u7528\u6237\u5bf9 file.txt \u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5e76\u4e14\u53d1\u751f\u4e86\u51b2\u7a81\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u89e3\u51b3\u51b2\u7a81\uff1a \u8fd0\u884c git status\uff0c\u53d1\u73b0 file.txt \u5b58\u5728\u51b2\u7a81\u3002 \u8fd0\u884c git diff file.txt\uff0c\u67e5\u770b\u5dee\u5f02\u3002 [&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-21573","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21573","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=21573"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21573\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}