{"id":1635,"date":"2023-03-25T11:41:00","date_gmt":"2023-03-25T03:41:00","guid":{"rendered":""},"modified":"2023-03-25T11:41:00","modified_gmt":"2023-03-25T03:41:00","slug":"Git reset","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1635.html","title":{"rendered":"Git reset"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

Git reset<\/h1>\n<\/p><\/div>\n
\n \u91cd\u7f6e\u4e00\u8bcd\u8868\u793a\u64a4\u6d88\u66f4\u6539\u3002 git reset\u547d\u4ee4\u7528\u4e8e\u91cd\u7f6e\u66f4\u6539\u3002 git reset\u547d\u4ee4\u5177\u6709\u4e09\u79cd\u6838\u5fc3\u8c03\u7528\u5f62\u5f0f\u3002\u8fd9\u4e9b\u5f62\u5f0f\u5982\u4e0b\u3002\n <\/div>\n

Soft <\/span>
\n Mixed <\/span>
\n Hard <\/span> <\/p>\n

\n \u5982\u679c\u6211\u4eec\u8bf4\u7684\u662fGit\uff0c\u90a3\u4e48Git\u662f\u5c06HEAD\u7684\u5f53\u524d\u72b6\u6001\u91cd\u7f6e\u4e3a\u6307\u5b9a\u72b6\u6001\u7684\u5de5\u5177\u3002\u5b83\u662f\u7528\u4e8e\u64a4\u6d88\u66f4\u6539\u7684\u590d\u6742\u800c\u901a\u7528\u7684\u5de5\u5177\u3002\u5b83\u5145\u5f53Git\u7684\u65f6\u95f4\u673a\u5668\u3002\u60a8\u53ef\u4ee5\u5728\u5404\u79cd\u63d0\u4ea4\u4e4b\u95f4\u6765\u56de\u8df3\u8f6c\u3002\u8fd9\u4e9b\u91cd\u7f6e\u53d8\u91cf\u4e2d\u7684\u6bcf\u4e00\u4e2a\u90fd\u4f1a\u5f71\u54cdgit\u7528\u6765\u5904\u7406\u5176\u5185\u5bb9\u4e2d\u7684\u6587\u4ef6\u7684\u7279\u5b9a\u6811\u3002\n <\/div>\n
\n \u6b64\u5916\uff0cgit reset\u53ef\u4ee5\u5728\u6574\u4e2a\u63d0\u4ea4\u5bf9\u8c61\u6216\u5355\u4e2a\u6587\u4ef6\u7ea7\u522b\u4e0a\u8fdb\u884c\u64cd\u4f5c\u3002\u8fd9\u4e9b\u91cd\u7f6e\u53d8\u91cf\u4e2d\u7684\u6bcf\u4e00\u4e2a\u90fd\u4f1a\u5f71\u54cdgit\u7528\u4e8e\u5904\u7406\u6587\u4ef6\u53ca\u5176\u5185\u5bb9\u7684\u7279\u5b9a\u6811\u3002\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c1\u5f20 <\/p>\n

\n Git\u4f7f\u7528\u7d22\u5f15(\u4e34\u65f6\u533a\u57df)\uff0cHEAD\u548c\u5de5\u4f5c\u76ee\u5f55\u6765\u521b\u5efa\u548c\u8fd8\u539f\u63d0\u4ea4\u3002\u5982\u679c\u60a8\u4e0d\u77e5\u9053\u4ec0\u4e48\u662f\u5934\uff0c\u6811\uff0c\u7d22\u5f15\uff0c\u90a3\u4e48\u8bf7\u8bbf\u95ee\u6b64\u5904 Git\u7d22\u5f15\u548c Git\u5934\u3002\n <\/div>\n
\n \u901a\u8fc7\u5de5\u4f5c\u76ee\u5f55\u53ef\u4ee5\u66f4\u6539\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u8fdb\u5165\u7d22\u5f15\u3002\u6682\u5b58\u533a\u57df\u4f7f\u60a8\u53ef\u4ee5\u9009\u62e9\u8981\u653e\u5165\u4e0b\u4e00\u6b21\u63d0\u4ea4\u7684\u5185\u5bb9\u3002\u63d0\u4ea4\u5bf9\u8c61\u662f\u5185\u5bb9\u7684\u52a0\u5bc6\u54c8\u5e0c\u7248\u672c\u3002\u5b83\u5177\u6709\u4e00\u4e9b\u7528\u4e8e\u6253\u5f00\u5148\u524d\u63d0\u4ea4\u7684\u5143\u6570\u636e\u548c\u70b9\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u4e86\u89e3git reset\u547d\u4ee4\u7684\u4e0d\u540c\u7528\u6cd5\u3002\n <\/div>\n

Git Reset Hard <\/h2>\n
\n \u5b83\u5c06\u9996\u5148\u79fb\u52a8Head\u5e76\u4f7f\u7528\u63d0\u4ea4\u7684\u5185\u5bb9\u66f4\u65b0\u7d22\u5f15\u3002\u8fd9\u662f\u6700\u76f4\u63a5\uff0c\u6700\u4e0d\u5b89\u5168\u4e14\u6700\u5e38\u7528\u7684\u9009\u9879\u3002--hard\u9009\u9879\u66f4\u6539\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\uff0c\u5e76\u4e14\u5c06\u5f15\u7528\u6307\u9488\u66f4\u65b0\u4e3a\u6307\u5b9a\u7684\u63d0\u4ea4\u3002\u7136\u540e\uff0c\u9700\u8981\u91cd\u7f6e\u6682\u5b58\u7d22\u5f15\u548c\u5de5\u4f5c\u76ee\u5f55\u4ee5\u5339\u914d\u6307\u5b9a\u63d0\u4ea4\u7684\u7d22\u5f15\u548c\u5de5\u4f5c\u76ee\u5f55\u3002\u4e4b\u524d\u6682\u5b58\u7684\u5bf9\u6682\u5b58\u7d22\u5f15\u7684\u63d0\u4ea4\u548c\u5de5\u4f5c\u76ee\u5f55\u90fd\u5c06\u91cd\u7f6e\u4e3a\u5339\u914d\u63d0\u4ea4\u6811\u3002\u8fd9\u610f\u5473\u7740\u6240\u6709\u7b49\u5f85\u7684\u5de5\u4f5c\u90fd\u5c06\u4e22\u5931\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u901a\u8fc7\u793a\u4f8b\u4e86\u89e3--hard\u9009\u9879\u3002\u5047\u8bbe\u6211\u5df2\u5c06\u4e00\u4e2a\u65b0\u6587\u4ef6\u6dfb\u52a0\u5230\u73b0\u6709\u5b58\u50a8\u5e93\u4e2d\u3002\u8981\u5c06\u65b0\u6587\u4ef6\u6dfb\u52a0\u5230\u5b58\u50a8\u5e93\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git add <file name><\/pre>\n

<\/code>\n <\/div>\n

\n \u8981\u68c0\u67e5\u5b58\u50a8\u5e93\u7684\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git status<\/pre>\n

<\/code>\n <\/div>\n

\n \u8981\u68c0\u67e5Head\u548c\u5148\u524d\u63d0\u4ea4\u7684\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git log<\/pre>\n

<\/code>\n <\/div>\n

\n \u8bf7\u8003\u8651\u4ee5\u4e0b\u56fe\u7247:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c2\u5f20 <\/p>\n

\n \u5728\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u6211\u6dfb\u52a0\u4e86\u4e00\u4e2a\u540d\u4e3a newfile2.txt \u7684\u6587\u4ef6\u3002\u6211\u5df2\u7ecf\u68c0\u67e5\u4e86\u5b58\u50a8\u5e93\u7684\u72b6\u6001\u3002\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5f53\u524d\u7684\u5934\u90e8\u4f4d\u7f6e\u5c1a\u672a\u66f4\u6539\uff0c\u56e0\u4e3a\u6211\u5c1a\u672a\u63d0\u4ea4\u66f4\u6539\u3002\u73b0\u5728\uff0c\u6211\u5c06\u6267\u884c\u91cd\u7f6e--hard \u9009\u9879\u3002 git reset hard\u547d\u4ee4\u7684\u6267\u884c\u65b9\u5f0f\u4e3a:\n <\/div>\n
\n
$ git reset--hard<\/pre>\n

<\/code>\n <\/div>\n

\n \u8bf7\u8003\u8651\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c3\u5f20 <\/p>\n

\n \u5982\u60a8\u5728\u4e0a\u8ff0\u8f93\u51fa\u4e2d\u770b\u5230\u7684\uff0c-hard\u9009\u9879\u5728\u53ef\u7528\u5b58\u50a8\u5e93\u4e0a\u64cd\u4f5c\u3002\u6b64\u9009\u9879\u5c06\u91cd\u7f6e\u66f4\u6539\u5e76\u5339\u914d\u4e0a\u4e00\u6b21\u66f4\u6539\u4e4b\u524d\u7684Head\u4f4d\u7f6e\u3002\u5b83\u5c06\u4ece\u767b\u53f0\u533a\u57df\u4e2d\u5220\u9664\u53ef\u7528\u7684\u66f4\u6539\u3002\u8003\u8651\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c4\u5f20 <\/p>\n

\n \u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u7ecf\u8fc7\u8270\u82e6\u5de5\u4f5c\u540e\u4ed3\u5e93\u7684\u72b6\u6001\u91cd\u542f\u3002\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6211\u7684\u5b58\u50a8\u5e93\u4e2d\u6ca1\u6709\u8981\u63d0\u4ea4\u7684\u5185\u5bb9\uff0c\u56e0\u4e3a\u901a\u8fc7reset hard\u9009\u9879\u5220\u9664\u7684\u6240\u6709\u66f4\u6539\u90fd\u5c06\u5176\u4e0e\u5f53\u524dHead\u7684\u72b6\u6001\u5339\u914d\u3002\u56e0\u6b64\uff0c\u6587\u4ef6 newfile2.txt \u5df2\u4ece\u5b58\u50a8\u5e93\u4e2d\u5220\u9664\u3002\n <\/div>\n
\n \u5728\u7684\u5e2e\u52a9\u4e0b\uff0c\u6709\u4e00\u79cd\u66f4\u5b89\u5168\u7684\u65b9\u5f0f\u6765\u91cd\u7f6e\u66f4\u6539\u3002 git stash \u3002\n <\/div>\n
\n \u901a\u5e38\uff0c\u786c\u91cd\u7f6e\u6a21\u5f0f\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c:\n <\/div>\n

\u5b83\u5c06\u79fb\u52a8HEAD\u6307\u9488\u3002<\/span>
\n \u5b83\u5c06\u7528HEAD\u6307\u5411\u7684\u5185\u5bb9\u66f4\u65b0\u6682\u5b58\u533a\u3002<\/span>
\n \u5b83\u5c06\u66f4\u65b0\u5de5\u4f5c\u76ee\u5f55\u4ee5\u5339\u914d\u6682\u5b58\u533a\u3002<\/span> <\/p>\n

Git Reset Mixed <\/h2>\n
\n \u6df7\u5408\u9009\u9879\u662fgit reset\u547d\u4ee4\u7684\u9ed8\u8ba4\u9009\u9879\u3002\u5982\u679c\u6211\u4eec\u4e0d\u4f20\u9012\u4efb\u4f55\u53c2\u6570\uff0c\u5219\u5c06git reset\u547d\u4ee4\u89c6\u4e3a-mixed \u4f5c\u4e3a\u9ed8\u8ba4\u9009\u9879\u3002\u6df7\u5408\u9009\u9879\u5c06\u66f4\u65b0ref\u6307\u9488\u3002\u767b\u53f0\u533a\u57df\u8fd8\u91cd\u7f6e\u4e3a\u6307\u5b9a\u63d0\u4ea4\u7684\u72b6\u6001\u3002\u64a4\u6d88\u7684\u66f4\u6539\u5df2\u4f20\u8f93\u5230\u5de5\u4f5c\u76ee\u5f55\u3002\u8ba9\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u4f8b\u5b50\u6765\u7406\u89e3\u5b83\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a newfile2.txt \u7684\u65b0\u6587\u4ef6\u3002\u68c0\u67e5\u5b58\u50a8\u5e93\u7684\u72b6\u6001\u3002\u8981\u68c0\u67e5\u5b58\u50a8\u5e93\u7684\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git status<\/pre>\n

<\/code>\n <\/div>\n

\n \u5b83\u5c06\u663e\u793a\u6682\u5b58\u533a\u57df\u4e2d\u672a\u8ddf\u8e2a\u7684\u6587\u4ef6\u3002\u5c06\u5176\u6dfb\u52a0\u5230\u7d22\u5f15\u3002\u8981\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u9636\u6bb5\u7d22\u5f15\u4e2d\uff0c\u8bf7\u8fd0\u884cgit add\u547d\u4ee4:\n <\/div>\n
\n
$ git add <filename><\/pre>\n

<\/code>\n <\/div>\n

\n \u4e0a\u9762\u7684\u547d\u4ee4\u4f1a\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u7d22\u5f15\u3002\u8003\u8651\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c5\u5f20 <\/p>\n

\n \u5728\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u6211\u6dfb\u52a0\u4e86 newfile2 .txt \u5230\u6211\u7684\u672c\u5730\u5b58\u50a8\u5e93\u3002\u73b0\u5728\uff0c\u6211\u4eec\u5c06\u5728\u6b64\u5b58\u50a8\u5e93\u4e0a\u6267\u884creset mixed\u547d\u4ee4\u3002\u5b83\u5c06\u8fd0\u884c\u4e3a:\n <\/div>\n
\n
$ git reset--mixed<\/pre>\n

<\/code>\n <\/div>\n

\n \u6216\u8005\u6211\u4eec\u53ea\u80fd\u4f7f\u7528git reset\u547d\u4ee4\u4ee3\u66ff\u6b64\u547d\u4ee4\u3002\n <\/div>\n
\n
$ git reset<\/pre>\n

<\/code>\n <\/div>\n

\n \u4ee5\u4e0a\u547d\u4ee4\u5c06\u91cd\u7f6e\u78c1\u5934\u7684\u72b6\u6001\uff0c\u5e76\u4e14\u4e0d\u4f1a\u4ece\u6682\u5b58\u533a\u57df\u4e2d\u5220\u9664\u4efb\u4f55\u4e0e\u78c1\u5934\u4f4d\u7f6e\u5339\u914d\u7684\u6570\u636e\u3002\u8003\u8651\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c6\u5f20 <\/p>\n

\n \u4ece\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u5df2\u7ecf\u91cd\u7f6e\u4e86\u901a\u8fc7\u6267\u884cgit reset-mixed\u547d\u4ee4\u6765\u8c03\u6574Head\u7684\u4f4d\u7f6e\u3002\u53e6\u5916\uff0c\u6211\u4eec\u5df2\u7ecf\u68c0\u67e5\u4e86\u5b58\u50a8\u5e93\u7684\u72b6\u6001\u3002\u5982\u6211\u4eec\u6240\u89c1\uff0c\u6b64\u547d\u4ee4\u5c1a\u672a\u66f4\u6539\u5b58\u50a8\u5e93\u7684\u72b6\u6001\u3002\u56e0\u6b64\u5f88\u660e\u663e\uff0c\u6df7\u5408\u6a21\u5f0f\u4e0d\u4f1a\u6e05\u9664\u6682\u5b58\u533a\u57df\u4e2d\u7684\u4efb\u4f55\u6570\u636e\u3002\n <\/div>\n
\n \u901a\u5e38\uff0c\u91cd\u7f6e\u6df7\u5408\u6a21\u5f0f\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c:\n <\/div>\n

\u5b83\u5c06\u79fb\u52a8HEAD\u6307\u9488<\/span>
\n \u5b83\u5c06\u7528HEAD\u6307\u5411\u7684\u5185\u5bb9\u66f4\u65b0\u6682\u5b58\u533a\u3002<\/span> <\/p>\n

\n \u5b83\u4e0d\u4f1a\u50cfgit hard\u6a21\u5f0f\u90a3\u6837\u66f4\u65b0\u5de5\u4f5c\u76ee\u5f55\u3002\u5b83\u5c06\u4ec5\u91cd\u7f6e\u7d22\u5f15\uff0c\u800c\u4e0d\u91cd\u7f6e\u5de5\u4f5c\u6811\uff0c\u7136\u540e\u751f\u6210\u5c1a\u672a\u66f4\u65b0\u7684\u6587\u4ef6\u7684\u62a5\u544a\u3002\n <\/div>\n
\n \u5982\u679c\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a-N\uff0c\u5219\u8be5\u8bed\u53e5\u5c06\u88ab\u89c6\u4e3a\n <\/div>\n

Git\u91cd\u7f6e\u5934(Git\u91cd\u7f6e\u8f6f)<\/h2>\n
\n soft\u9009\u9879\u6839\u672c\u4e0d\u6d89\u53ca\u7d22\u5f15\u6587\u4ef6\u6216\u5de5\u4f5c\u6811\uff0c\u4f46\u5b83\u4f1a\u50cf\u6240\u6709\u9009\u9879\u4e00\u6837\u91cd\u7f6eHead\u3002\u5f53\u8f6f\u6a21\u5f0f\u8fd0\u884c\u65f6\uff0crefs\u6307\u9488\u5c06\u66f4\u65b0\uff0c\u5e76\u4e14\u91cd\u7f6e\u5c06\u5728\u6b64\u5904\u505c\u6b62\u3002\u5b83\u5c06\u5145\u5f53git amend\u547d\u4ee4\u3002\u8fd9\u4e0d\u662f\u6743\u5a01\u547d\u4ee4\u3002\u6709\u65f6\u5f00\u53d1\u4eba\u5458\u8ba4\u4e3a\u8fd9\u662f\u6d6a\u8d39\u65f6\u95f4\u3002\n <\/div>\n
\n \u901a\u5e38\uff0c\u5b83\u7528\u4e8e\u66f4\u6539Head\u7684\u4f4d\u7f6e\u3002\u8ba9\u6211\u4eec\u4e86\u89e3\u4e00\u4e0b\u5b83\u5c06\u5982\u4f55\u6539\u53d8Head\u7684\u4f4d\u7f6e\u3002\u5b83\u5c06\u7528\u4f5c:\n <\/div>\n
\n
$ git reset--soft <commit-sha><\/pre>\n

<\/code>\n <\/div>\n

\n \u4e0a\u9762\u7684\u547d\u4ee4\u4f1a\u5c06HEAD\u79fb\u52a8\u5230\u7279\u5b9a\u7684\u63d0\u4ea4\u3002\u8ba9\u6211\u4eec\u7528\u4e00\u4e2a\u4f8b\u5b50\u6765\u7406\u89e3\u5b83\u3002\n <\/div>\n
\n \u6211\u5df2\u7ecf\u5728\u6587\u4ef6newfile2.txt\u4e2d\u8fdb\u884c\u4e86\u66f4\u6539\u5e76\u63d0\u4ea4\u3002\u56e0\u6b64\uff0cHead\u7684\u5f53\u524d\u4f4d\u7f6e\u5728\u6700\u8fd1\u4e00\u6b21\u63d0\u4ea4\u65f6\u53d1\u751f\u4e86\u79fb\u4f4d\u3002\u8981\u68c0\u67e5Head\u7684\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git log<\/pre>\n

<\/code>\n <\/div>\n

\n \u8003\u8651\u4ee5\u4e0b\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c7\u5f20 <\/p>\n

\n \u4ece\u4ee5\u4e0a\u8f93\u51fa\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230HEAD\u7684\u5f53\u524d\u4f4d\u7f6e\u5728f1d4b486f2eeefe575194d51ec3a54926ab05ef7 commit\u4e0a\u3002\u4f46\u662f\uff0c\u6211\u60f3\u5728\u6211\u7684\u65e7\u63d0\u4ea42c5a8820091654ac5b8beed774fe6061954cfe92\u4e0a\u5207\u6362\u5b83\u3002\u7531\u4e8ecommit-sha\u7f16\u53f7\u662fsha\u7b97\u6cd5\u63d0\u4f9b\u7684\u552f\u4e00\u7f16\u53f7\u3002\u8981\u5207\u6362HEAD\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n
\n
$ git reset--soft  2c5a8820091654<\/pre>\n

<\/code>\n <\/div>\n

\n \u4e0a\u9762\u7684\u547d\u4ee4\u4f1a\u5c06\u6211\u7684HEAD\u79fb\u81f3\u7279\u5b9a\u7684\u63d0\u4ea4\u3002\u8003\u8651\u4e0b\u9762\u7684\u8f93\u51fa:\n <\/div>\n

Git reset_https:\/\/bianchenghao6.com_\u3010Git \u6559\u7a0b\u3011_\u7b2c8\u5f20 <\/p>\n

\n \u4ece\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u5230\uff0cHEAD\u5df2\u7ecf\n <\/div>\n

Git\u91cd\u7f6e\u4e3a\u63d0\u4ea4<\/h2>\n
\n \u6709\u65f6\u6211\u4eec\u9700\u8981\u91cd\u7f6e\u7279\u5b9a\u7684\u63d0\u4ea4\uff1b Git\u5141\u8bb8\u6211\u4eec\u8fd9\u6837\u505a\u3002\u6211\u4eec\u53ef\u4ee5\u91cd\u7f6e\u4e3a\u7279\u5b9a\u7684\u63d0\u4ea4\u3002\u8981\u91cd\u7f6e\u5b83\uff0c\u53ef\u4ee5\u5c06git reset\u547d\u4ee4\u4e0ereset\u547d\u4ee4\u652f\u6301\u7684\u4efb\u4f55\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u5c06\u91c7\u7528\u7279\u5b9a\u547d\u4ee4\u7684\u9ed8\u8ba4\u884c\u4e3a\u5e76\u91cd\u7f6e\u7ed9\u5b9a\u7684\u63d0\u4ea4\u3002\u91cd\u7f6e\u63d0\u4ea4\u7684\u8bed\u6cd5\u5982\u4e0b:\n <\/div>\n
\n
$ git reset <option> <commit-sha><\/pre>\n

<\/code>\n <\/div>\n

\n \u8fd9\u4e9b\u9009\u9879\u53ef\u4ee5\u662f\n <\/div>\n

--soft <\/span>
\n --mixed<\/span>
\n --Hard<\/span> <\/p>\n


\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Git resetzh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149],"tags":[],"class_list":["post-1635","post","type-post","status-publish","format-standard","hentry","category-gitjc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1635"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1635"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1635\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}