{"id":19934,"date":"2024-11-19T13:02:01","date_gmt":"2024-11-19T05:02:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19934\/"},"modified":"2024-11-19T13:02:01","modified_gmt":"2024-11-19T05:02:01","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8git%e4%b8%ad%e4%bf%ae%e6%94%b9%e7%94%a8%e6%88%b7%e5%90%8d%e5%92%8c%e7%94%b5%e5%ad%90%e9%82%ae%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19934\/","title":{"rendered":"\u5982\u4f55\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6"},"content":{"rendered":"<p>\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5f88\u7b80\u5355\u3002\u5f53\u4f60\u8fdb\u884cgit commit\u65f6\uff0c\u5728\u6bcf\u4e00\u6b21\u63d0\u4ea4\u4e2d\u90fd\u5305\u542b\u4e86\u63d0\u4ea4\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u4fe1\u606f\u3002\u8fd9\u4e9b\u4fe1\u606f\u88ab\u7528\u6765\u8ffd\u8e2a\u8c01\u63d0\u4ea4\u4e86\u54ea\u4e2a\u4ee3\u7801\u3002\u56e0\u6b64\uff0c\u5728git\u4e2d\u4fee\u6539\u8fd9\u4e9b\u4fe1\u606f\u975e\u5e38\u91cd\u8981\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u7d22\u5982\u4f55\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<p>\u6b65\u9aa4\u4e00\uff1a\u67e5\u770b\u5f53\u524d\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6<\/p>\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u68c0\u67e5\u5f53\u524d\u8bbe\u7f6e\u7684git\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<p>\u8981\u67e5\u770b\u5f53\u524d\u7684git\u7528\u6237\u540d\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git config user.name<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8981\u67e5\u770b\u5f53\u524d\u7684git\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git config user.email<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u672a\u8bbe\u7f6e\u7528\u6237\u540d\u6216\u7535\u5b50\u90ae\u4ef6\uff0c\u5219\u4f1a\u51fa\u73b0\u7a7a\u767d\u5c4f\u5e55\u3002<\/p>\n<p>\u6b65\u9aa4\u4e8c\uff1a\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6<\/p>\n<p>\u8981\u4fee\u6539git\u7528\u6237\u540d\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git config --global user.name \"your-username\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8981\u4fee\u6539git\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git config --global user.email \"your-email-address\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06\u201cyour-username\u201d\u66f4\u6539\u4e3a\u60a8\u5e0c\u671b\u663e\u793a\u7684\u7528\u6237\u540d\uff0c\u5e76\u5c06\u201cyour-email-address\u201d\u66f4\u6539\u4e3a\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u201c&#8211;global\u201d\u9009\u9879\u5c06\u66f4\u6539\u5e94\u7528\u4e8e\u6240\u6709git\u4ed3\u5e93\u3002\u5982\u679c\u60a8\u53ea\u60f3\u5bf9\u5f53\u524dgit\u4ed3\u5e93\u8fdb\u884c\u66f4\u6539\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u201c&#8211;global\u201d\u9009\u9879\u3002<\/p>\n<p>\u6b65\u9aa4\u4e09\uff1a\u68c0\u67e5\u66f4\u6539<\/p>\n<p>\u8981\u786e\u8ba4\u66f4\u6539\u5df2\u6210\u529f\u5e94\u7528\uff0c\u8bf7\u518d\u6b21\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git config user.name<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236     <\/p>\n<pre>git config user.email<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u5c06\u8f93\u51fa\u60a8\u7684\u65b0\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/p>\n<p>\u6b65\u9aa4\u56db\uff1a\u66f4\u6539\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55<\/p>\n<p>\u5982\u679c\u60a8\u5df2\u7ecf\u5728\u4e4b\u524d\u7684\u63d0\u4ea4\u4e2d\u4f7f\u7528\u4e86\u65e7\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u5219\u9700\u8981\u66f4\u6539\u60a8\u7684\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\u3002\u4e3a\u6b64\uff0c\u60a8\u9700\u8981\u4f7f\u7528git rebase\u547d\u4ee4\u3002<\/p>\n<p>\u8981\u4f7f\u7528git rebase\u547d\u4ee4\uff0c\u9996\u5148\u68c0\u51fa\u4f60\u7684git\u4ed3\u5e93\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git rebase -i HEAD~n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u201cn\u201d\u662f\u4e00\u4e2a\u6570\u5b57\uff0c\u8868\u793a\u60a8\u8981\u7f16\u8f91\u7684\u63d0\u4ea4\u6570\u3002\u8fd9\u5c06\u5728nano\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u4e00\u4efd\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u60a8\u8981\u7f16\u8f91\u7684\u63d0\u4ea4\u3002\u4f7f\u7528nano\u7f16\u8f91\u5668\uff0c\u5c06\u8981\u66f4\u6539\u7684\u63d0\u4ea4\u7684\u201cpick\u201d\u66ff\u6362\u4e3a\u201cedit\u201d\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u8981\u66f4\u6539\u524d5\u4e2a\u63d0\u4ea4\uff0c\u5219\u547d\u4ee4\u5c06\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>git rebase -i HEAD~5<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06\u7b2c\u4e00\u4e2a\u63d0\u4ea4\u7684\u201cpick\u201d\u66ff\u6362\u4e3a\u201cedit\u201d\uff0c\u7136\u540e\u4fdd\u5b58\u6587\u4ef6\u5e76\u5173\u95ednano\u7f16\u8f91\u5668\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u66f4\u6539\u60a8\u60f3\u8981\u66f4\u6539\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/p>\n<p>\u8981\u66f4\u6539\u63d0\u4ea4\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git commit --amend --author='Author Name &lt;email@address.com&gt;'<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06\u201cAuthor Name\u201d\u66f4\u6539\u4e3a\u60a8\u7684\u65b0\u7528\u6237\u540d\uff0c\u5e76\u5c06\u201cemail@address.com\u201d\u66f4\u6539\u4e3a\u60a8\u7684\u65b0\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u201c&#8211;amend\u201d\u9009\u9879\u7528\u4e8e\u66f4\u6539\u4e0a\u4e00\u6b21\u63d0\u4ea4\uff0c\u5e76\u4e14\u60a8\u9700\u8981\u5728\u6bcf\u4e2a\u8981\u66f4\u6539\u7684\u63d0\u4ea4\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u3002<\/p>\n<p>\u5b8c\u6210\u66f4\u6539\u540e\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884cgit rebase\u64cd\u4f5c\uff1a<\/p>\n<pre>git rebase --continue<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u5c06\u5e94\u7528\u66f4\u6539\u5e76\u7ee7\u7eed\u8fdb\u884crebase\u64cd\u4f5c\u3002<\/p>\n<p>\u4e00\u65e6\u64cd\u4f5c\u5b8c\u6210\uff0c\u60a8\u73b0\u5728\u5df2\u7ecf\u6210\u529f\u4fee\u6539\u4e86\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u5e76\u66f4\u6b63\u4e86\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<p>\u7ed3\u8bba<\/p>\n<p>\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u975e\u5e38\u7b80\u5355\u3002\u53ea\u9700\u51e0\u4e2a\u7b80\u5355\u7684\u6b65\u9aa4\uff0c\u60a8\u5c31\u53ef\u4ee5\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u5e76\u66f4\u6b63\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\u3002\u7ba1\u7406\u597d\u60a8\u7684git\u8d26\u6237\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3agit\u662f\u73b0\u4ee3\u8f6f\u4ef6\u5f00\u53d1\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u5de5\u5177\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\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>\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5f88\u7b80\u5355\u3002\u5f53\u4f60\u8fdb\u884cgit commit\u65f6\uff0c\u5728\u6bcf\u4e00\u6b21\u63d0\u4ea4\u4e2d\u90fd\u5305\u542b\u4e86\u63d0\u4ea4\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u4fe1\u606f\u3002\u8fd9\u4e9b\u4fe1\u606f\u88ab\u7528\u6765\u8ffd\u8e2a\u8c01\u63d0\u4ea4\u4e86\u54ea\u4e2a\u4ee3\u7801\u3002\u56e0\u6b64\uff0c\u5728git\u4e2d\u4fee\u6539\u8fd9\u4e9b\u4fe1\u606f\u975e\u5e38\u91cd\u8981\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u7d22\u5982\u4f55\u5728git\u4e2d\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002 \u6b65\u9aa4\u4e00\uff1a\u67e5\u770b\u5f53\u524d\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6 \u9996\u5148\uff0c\u8ba9\u6211\u4eec\u68c0\u67e5\u5f53\u524d\u8bbe\u7f6e\u7684git\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002 \u8981\u67e5\u770b\u5f53\u524d\u7684git\u7528\u6237\u540d\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a git config user.name \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u8981\u67e5\u770b\u5f53\u524d\u7684git\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a git config user.email \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u672a\u8bbe\u7f6e\u7528\u6237\u540d\u6216\u7535\u5b50\u90ae\u4ef6\uff0c\u5219\u4f1a\u51fa\u73b0\u7a7a\u767d\u5c4f\u5e55\u3002 \u6b65\u9aa4\u4e8c\uff1a\u4fee\u6539\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6 \u8981\u4fee\u6539git\u7528\u6237\u540d\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a git config &#8211;global user.name &#8220;your-username&#8221; \u767b\u5f55\u540e\u590d\u5236 \u8981\u4fee\u6539git\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a git config &#8211;global user.email &#8220;your-email-address&#8221; \u767b\u5f55\u540e\u590d\u5236 \u5c06\u201cyour-username\u201d\u66f4\u6539\u4e3a\u60a8\u5e0c\u671b\u663e\u793a\u7684\u7528\u6237\u540d\uff0c\u5e76\u5c06\u201cyour-email-address\u201d\u66f4\u6539\u4e3a\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002 \u8bf7\u6ce8\u610f\uff0c\u201c&#8211;global\u201d\u9009\u9879\u5c06\u66f4\u6539\u5e94\u7528\u4e8e\u6240\u6709git\u4ed3\u5e93\u3002\u5982\u679c\u60a8\u53ea\u60f3\u5bf9\u5f53\u524dgit\u4ed3\u5e93\u8fdb\u884c\u66f4\u6539\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u201c&#8211;global\u201d\u9009\u9879\u3002 \u6b65\u9aa4\u4e09\uff1a\u68c0\u67e5\u66f4\u6539 \u8981\u786e\u8ba4\u66f4\u6539\u5df2\u6210\u529f\u5e94\u7528\uff0c\u8bf7\u518d\u6b21\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a git config user.name \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 git config user.email \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u5c06\u8f93\u51fa\u60a8\u7684\u65b0\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002 \u6b65\u9aa4\u56db\uff1a\u66f4\u6539\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55 \u5982\u679c\u60a8\u5df2\u7ecf\u5728\u4e4b\u524d\u7684\u63d0\u4ea4\u4e2d\u4f7f\u7528\u4e86\u65e7\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u5219\u9700\u8981\u66f4\u6539\u60a8\u7684\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\u3002\u4e3a\u6b64\uff0c\u60a8\u9700\u8981\u4f7f\u7528git rebase\u547d\u4ee4\u3002 \u8981\u4f7f\u7528git rebase\u547d\u4ee4\uff0c\u9996\u5148\u68c0\u51fa\u4f60\u7684git\u4ed3\u5e93\u3002 \u63a5\u4e0b\u6765\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a git rebase [&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-19934","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19934","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=19934"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19934\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}