{"id":21524,"date":"2024-11-19T09:52:31","date_gmt":"2024-11-19T01:52:31","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21524\/"},"modified":"2024-11-19T09:52:31","modified_gmt":"2024-11-19T01:52:31","slug":"git-commit%e6%80%8e%e4%b9%88%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21524\/","title":{"rendered":"git commit\u600e\u4e48\u7528"},"content":{"rendered":"<blockquote><p>\n  git commit \u662f\u4e00\u79cd\u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u53d8\u66f4\u8bb0\u5f55\u5230 git \u5b58\u50a8\u5e93\u4e2d\uff0c\u4ee5\u4fdd\u5b58\u9879\u76ee\u5f53\u524d\u72b6\u6001\u7684\u5feb\u7167\u3002\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a\u6dfb\u52a0\u53d8\u66f4\u5230\u6682\u5b58\u533a\u57df\u7f16\u5199\u7b80\u6d01\u4e14\u4fe1\u606f\u4e30\u5bcc\u7684\u63d0\u4ea4\u6d88\u606f\u4fdd\u5b58\u5e76\u9000\u51fa\u63d0\u4ea4\u6d88\u606f\u4ee5\u5b8c\u6210\u63d0\u4ea4\u53ef\u9009\uff1a\u4e3a\u63d0\u4ea4\u6dfb\u52a0\u7b7e\u540d\u4f7f\u7528 git log \u67e5\u770b\u63d0\u4ea4\u5185\u5bb9\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023125488863.jpg\" class=\"aligncenter\" title=\"git commit\u600e\u4e48\u7528\u63d2\u56fe\" alt=\"git commit\u600e\u4e48\u7528\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4f7f\u7528 Git Commit<\/strong><\/p>\n<p><strong>\u4ec0\u4e48\u662f Git Commit\uff1f<\/strong><\/p>\n<p>Git commit \u662f\u4e00\u4e2a\u547d\u4ee4\uff0c\u7528\u4e8e\u5c06\u6587\u4ef6\u53d8\u66f4\u8bb0\u5f55\u5230 Git \u5b58\u50a8\u5e93\u4e2d\u3002\u5b83\u4fdd\u5b58\u9879\u76ee\u5f53\u524d\u72b6\u6001\u7684\u5feb\u7167\uff0c\u5e76\u8bb0\u5f55\u4e86\u53d8\u66f4\u548c\u4f5c\u8005\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Git Commit<\/strong><\/p>\n<p><strong>1. \u6dfb\u52a0\u53d8\u66f4\uff1a<\/strong><\/p>\n<p>\u5728\u8981\u63d0\u4ea4\u7684\u6587\u4ef6\u4e0a\u8fd0\u884c  add \u547d\u4ee4\u3002\u8fd9\u4f1a\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff0c\u8868\u793a\u8fd9\u4e9b\u6587\u4ef6\u5df2\u51c6\u5907\u63d0\u4ea4\u3002<\/p>\n<p><strong>2. \u7f16\u5199\u63d0\u4ea4\u6d88\u606f\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528 git commit \u547d\u4ee4\u6253\u5f00\u6587\u672c\u7f16\u8f91\u5668\u8f93\u5165\u63d0\u4ea4\u6d88\u606f\u3002\u63d0\u4ea4\u6d88\u606f\u5e94\u7b80\u8981\u4e14\u4fe1\u606f\u4e30\u5bcc\uff0c\u8bf4\u660e\u6240\u505a\u7684\u53d8\u66f4\u3002<\/p>\n<p><strong>3. \u63d0\u4ea4\u53d8\u66f4\uff1a<\/strong><\/p>\n<p>\u63d0\u4ea4\u6d88\u606f\u5b8c\u6210\u540e\uff0c\u8f93\u5165 :wq \u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002\u8fd9\u4f1a\u8fd0\u884c commit \u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u4ece\u6682\u5b58\u533a\u57df\u63d0\u4ea4\u5230\u5b58\u50a8\u5e93\u3002<\/p>\n<p><strong>4. \u53ef\u9009\uff1a\u6dfb\u52a0\u7b7e\u540d\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c git commit -S \u6765\u5bf9\u63d0\u4ea4\u8fdb\u884c\u7b7e\u540d\u3002\u8fd9\u4f1a\u4f7f\u7528\u60a8\u7684 GPG \u5bc6\u94a5\u5bf9\u63d0\u4ea4\u8fdb\u884c\u6570\u5b57\u7b7e\u540d\uff0c\u63d0\u4f9b\u989d\u5916\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p><strong>5. \u67e5\u770b\u53d8\u66f4\uff1a<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u63d0\u4ea4\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528 git log \u547d\u4ee4\u3002\u5b83\u5c06\u663e\u793a\u63d0\u4ea4\u7684\u5217\u8868\uff0c\u5305\u62ec\u63d0\u4ea4\u6d88\u606f\u3001\u4f5c\u8005\u4fe1\u606f\u548c\u53d8\u66f4\u3002<\/p>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u4fdd\u6301\u63d0\u4ea4\u6d88\u606f\u7b80\u77ed\u4e14\u7279\u5b9a\u4e8e\u53d8\u66f4\u3002<\/li>\n<li>\u4f7f\u7528\u73b0\u5728\u65f6\u6001\u7f16\u5199\u63d0\u4ea4\u6d88\u606f\u3002<\/li>\n<li>\u4f7f\u7528\u6362\u884c\u7b26\u6765\u589e\u5f3a\u53ef\u8bfb\u6027\u3002<\/li>\n<li>\u4f7f\u7528 -a \u6807\u5fd7\u6765\u6dfb\u52a0\u6240\u6709\u8ddf\u8e2a\u7684\u6587\u4ef6\u3002<\/li>\n<li>\u4f7f\u7528 &#8211;amend \u6807\u5fd7\u6765\u4fee\u6539\u6700\u65b0\u63d0\u4ea4\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f commit\u600e\u4e48\u7528\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>git commit \u662f\u4e00\u79cd\u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u53d8\u66f4\u8bb0\u5f55\u5230 git \u5b58\u50a8\u5e93\u4e2d\uff0c\u4ee5\u4fdd\u5b58\u9879\u76ee\u5f53\u524d\u72b6\u6001\u7684\u5feb\u7167\u3002\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a\u6dfb\u52a0\u53d8\u66f4\u5230\u6682\u5b58\u533a\u57df\u7f16\u5199\u7b80\u6d01\u4e14\u4fe1\u606f\u4e30\u5bcc\u7684\u63d0\u4ea4\u6d88\u606f\u4fdd\u5b58\u5e76\u9000\u51fa\u63d0\u4ea4\u6d88\u606f\u4ee5\u5b8c\u6210\u63d0\u4ea4\u53ef\u9009\uff1a\u4e3a\u63d0\u4ea4\u6dfb\u52a0\u7b7e\u540d\u4f7f\u7528 git log \u67e5\u770b\u63d0\u4ea4\u5185\u5bb9 \u4f7f\u7528 Git Commit \u4ec0\u4e48\u662f Git Commit\uff1f Git commit \u662f\u4e00\u4e2a\u547d\u4ee4\uff0c\u7528\u4e8e\u5c06\u6587\u4ef6\u53d8\u66f4\u8bb0\u5f55\u5230 Git \u5b58\u50a8\u5e93\u4e2d\u3002\u5b83\u4fdd\u5b58\u9879\u76ee\u5f53\u524d\u72b6\u6001\u7684\u5feb\u7167\uff0c\u5e76\u8bb0\u5f55\u4e86\u53d8\u66f4\u548c\u4f5c\u8005\u4fe1\u606f\u3002 \u5982\u4f55\u4f7f\u7528 Git Commit 1. \u6dfb\u52a0\u53d8\u66f4\uff1a \u5728\u8981\u63d0\u4ea4\u7684\u6587\u4ef6\u4e0a\u8fd0\u884c add \u547d\u4ee4\u3002\u8fd9\u4f1a\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff0c\u8868\u793a\u8fd9\u4e9b\u6587\u4ef6\u5df2\u51c6\u5907\u63d0\u4ea4\u3002 2. \u7f16\u5199\u63d0\u4ea4\u6d88\u606f\uff1a \u4f7f\u7528 git commit \u547d\u4ee4\u6253\u5f00\u6587\u672c\u7f16\u8f91\u5668\u8f93\u5165\u63d0\u4ea4\u6d88\u606f\u3002\u63d0\u4ea4\u6d88\u606f\u5e94\u7b80\u8981\u4e14\u4fe1\u606f\u4e30\u5bcc\uff0c\u8bf4\u660e\u6240\u505a\u7684\u53d8\u66f4\u3002 3. \u63d0\u4ea4\u53d8\u66f4\uff1a \u63d0\u4ea4\u6d88\u606f\u5b8c\u6210\u540e\uff0c\u8f93\u5165 :wq \u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002\u8fd9\u4f1a\u8fd0\u884c commit \u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u4ece\u6682\u5b58\u533a\u57df\u63d0\u4ea4\u5230\u5b58\u50a8\u5e93\u3002 4. \u53ef\u9009\uff1a\u6dfb\u52a0\u7b7e\u540d\uff1a \u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c git commit -S \u6765\u5bf9\u63d0\u4ea4\u8fdb\u884c\u7b7e\u540d\u3002\u8fd9\u4f1a\u4f7f\u7528\u60a8\u7684 GPG \u5bc6\u94a5\u5bf9\u63d0\u4ea4\u8fdb\u884c\u6570\u5b57\u7b7e\u540d\uff0c\u63d0\u4f9b\u989d\u5916\u7684\u5b89\u5168\u6027\u3002 5. \u67e5\u770b\u53d8\u66f4\uff1a \u8981\u67e5\u770b\u63d0\u4ea4\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528 git log \u547d\u4ee4\u3002\u5b83\u5c06\u663e\u793a\u63d0\u4ea4\u7684\u5217\u8868\uff0c\u5305\u62ec\u63d0\u4ea4\u6d88\u606f\u3001\u4f5c\u8005\u4fe1\u606f\u548c\u53d8\u66f4\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-21524","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21524","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=21524"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21524\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}