{"id":427298,"date":"2021-04-15T22:12:26","date_gmt":"2021-04-15T14:12:26","guid":{"rendered":"http:\/\/4563.org\/?p=427298"},"modified":"2021-04-15T22:12:26","modified_gmt":"2021-04-15T14:12:26","slug":"%e7%94%a8-git-%e8%b8%a9%e4%ba%86%e4%b8%aa%e5%9d%91","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=427298","title":{"rendered":"\u7528 git \u8e29\u4e86\u4e2a\u5751"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u7528 git \u8e29\u4e86\u4e2a\u5751               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : clrss <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e8b\u4ef6\u987a\u5e8f<\/p>\n<ol>\n<li>\u6dfb\u52a0\u6587\u4ef6 A &#8212; commit1<\/li>\n<li>\u4e00\u822c\u64cd\u4f5c &#8212; commit2~9<\/li>\n<li><code>git rm --cached A<\/code> \u5e76\u628a A \u6dfb\u52a0\u5230 gitignore &#8212; commit10<\/li>\n<li><code>git rebase -i commit2<\/code>. \u4fdd\u6301 commit10 \u4e0d\u53d8<\/li>\n<li>\u56de\u653e commit10 \u65f6, \u6587\u4ef6 A \u5c31\u4e22\u4e86&#8230;<\/li>\n<\/ol><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5736252\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yiXu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @clrss \u6ca1\u600e\u4e48\u770b\u61c2\uff0c\u80fd\u7ed9\u51fa\u53ef\u590d\u73b0\u7684\uff0c\u6240\u6709\u64cd\u4f5c\u7684\u547d\u4ee4\u884c\u4ee3\u7801\u5417\uff1f gist \u7ed9\u4e2a\u6700\u597d\uff0c\u6211\u60f3\u8bd5\u8bd5\u770b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736253\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : momocraft <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             commit10 \u5220\u6389\u4e86 A, apply \u65f6\u4e5f\u5220\u6389 A \u4e0d\u662f\u6b63\u5e38\u7684\u5417?<\/p>\n<p>\u4f60\u7684\u671f\u5f85\u662f apply \u540e A \u7559\u5728 worktree? \u53ef\u662f commit \u4e00\u7ea7\u4e0d\u4fdd\u7559\u8fd9\u4e2a\u4fe1\u606f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736254\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b7e\u51fa commit9 \u4e0d\u5c31\u56de\u6765\u4e86\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736255\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hw93 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ea\u8981 commit \u4e86\uff0c\u6587\u4ef6\u5c31\u4e0d\u4f1a\u4e22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736256\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : clrss <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xuanbg <br \/>@hw93 <\/p>\n<p>\u590d\u73b0\u6b65\u9aa4\u603b\u7ed3\u9519\u4e86.<\/p>\n<p>\u5b9e\u9645\u4e0a\u662f<br \/>git rm A<br \/>mv \/some\/other\/file A                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736257\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dezng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4f60\u4e0a\u9762\u7684\u64cd\u4f5c\uff0crebase \u57fa\u4e8e commit2\uff0ccommit1 \u8fd8\u5b58\u5728\uff0cA \u6587\u4ef6\u80af\u5b9a\u8fd8\u5728\u3002\u5373\u4f7f commit1 \u6ca1\u4e86\uff0c\u4e00\u822c\u901a\u8fc7 git reflog \u4e5f\u80fd\u627e\u56de\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736258\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : clrss <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dezng \u770b\u9644\u8a00, \u5b9e\u9645\u4e0a\u662f git rm A, \u7136\u540e\u6362\u4e86\u4e2a\u540c\u540d\u6587\u4ef6. \u6211\u8981\u7684\u662f\u540e\u6765\u6362\u7684\u540c\u540d\u6587\u4ef6.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5736259\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dezng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @clrss commit1 \u8fd8\u5728\uff0cA \u4e00\u5b9a\u8fd8\u5728 git checkout commit1 &#8212; path\/to\/A \u4f60\u5c31\u770b\u5230\u539f\u6765\u7684 A \u6587\u4ef6\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u7528 git \u8e29\u4e86\u4e2a\u5751 \u8cc7\u6df1\u5927\u4f6c :&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/427298"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=427298"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/427298\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427298"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}