{"id":2611,"date":"2016-01-08T15:43:21","date_gmt":"2016-01-08T07:43:21","guid":{"rendered":"http:\/\/www.hiheng.com\/blog\/?p=2611"},"modified":"2016-01-08T16:12:29","modified_gmt":"2016-01-08T08:12:29","slug":"10%e4%b8%aa%e5%be%88%e6%9c%89%e7%94%a8%e7%9a%84%e9%ab%98%e7%ba%a7-git-%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"http:\/\/www.hiheng.com\/blog\/?p=2611","title":{"rendered":"10\u4e2a\u5f88\u6709\u7528\u7684\u9ad8\u7ea7 Git \u547d\u4ee4"},"content":{"rendered":"<p>\u8fc4\u4eca\uff0c\u6211\u5df2\u7ecf\u4f7f\u7528Git\u5f88\u957f\u4e00\u6bb5\u65f6\u95f4\u4e86\uff0c\u8003\u8651\u5206\u4eab\u4e00\u4e9b\u4e0d\u7ba1\u4f60\u662f\u56e2\u961f\u5f00\u53d1\u8fd8\u662f\u4e2a\u4eba\u9879\u76ee\uff0c\u90fd\u53d7\u7528\u7684\u9ad8\u7ea7git\u547d\u4ee4\u3002<\/p>\n<p><strong>1. \u8f93\u51fa\u6700\u540e\u4e00\u6b21\u63d0\u4ea4\u7684\u6539\u53d8<\/strong><br \/>\n\u8fd9\u4e2a\u547d\u4ee4\uff0c\u6211\u7ecf\u5e38\u4f7f\u7528\u5b83 \u6765\u53d1\u9001\u5176\u4ed6\u6ca1\u6709\u4f7f\u7528git\u7684\u4eba\u6765\u68c0\u67e5\u6216\u8005\u96c6\u6210\u6240\u4fee\u6539\u7684\u3002\u5b83\u4f1a\u8f93\u51fa\u6700\u8fd1\u63d0\u4ea4\u7684\u4fee\u6539\u5185\u5bb9\u5230\u4e00\u4e2azip\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>git archive -o ..\/updated.zip HEAD $(git diff &#8211;name-only HEAD^)<\/p>\n<blockquote><p>\n\u5982\u679c\u4f60\u7684 tag \u540d\u662f 1.0\uff0c\u53ef\u4ee5\u6309\u7167\u5982\u4e0b\u65b9\u5f0f\u5bfc\u51fa\u3002<\/p>\n<p>a. \u5bfc\u51fa\u5e76\u538b\u7f29\u4e3a zip \u683c\u5f0f:<br \/>\n$ git archive &#8211;format=zip &#8211;output=v1.0.zip 1.0<\/p>\n<p>b. \u5bfc\u51fa\u5e76\u538b\u7f29\u4e3a tar.bz2 \u683c\u5f0f:<br \/>\n$ git archive 1.0 | bzip2 > v1.0.tar.bz2<\/p>\n<p>c. \u5bfc\u51fa\u5e76\u538b\u7f29\u4e3a tar.gz \u683c\u5f0f:<br \/>\n$ git archive &#8211;format=tar 1.0 | gzip > v1.0.tar.gz<\/p>\n<\/blockquote>\n<p><strong>2. \u8f93\u51fa\u4e24\u4e2a\u63d0\u4ea4\u95f4\u7684\u6539\u53d8<\/strong><br \/>\n\u7c7b\u4f3c\u7684\uff0c\u5982\u679c\u4f60\u9700\u8981\u8f93\u51fa\u67d0\u4e24\u4e2a\u63d0\u4ea4\u95f4\u7684\u6539\u53d8\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u3002<\/p>\n<p>git archive -o ..\/latest.zip NEW_COMMIT_ID_HERE $(git diff &#8211;name-only OLD_COMMIT_ID_HERE NEW_COMMIT_ID_HERE)<\/p>\n<p><strong>3. \u514b\u9686 \u6307\u5b9a\u7684\u8fdc\u7a0b\u5206\u652f<\/strong><br \/>\n\u5982\u679c\u4f60\u6e34\u671b\u53ea\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93\u7684\u4e00\u4e2a\u6307\u5b9a\u5206\u652f\uff0c\u800c\u4e0d\u662f\u6574\u4e2a\u4ed3\u5e93\u5206\u652f\uff0c\u8fd9\u5bf9\u4f60\u5e2e\u52a9\u5f88\u5927\u3002<\/p>\n<p>git init<br \/>\ngit remote add -t BRANCH_NAME_HERE -f origin REMOTE_REPO_URL_PATH_HERE<br \/>\ngit checkout BRANCH_NAME_HERE<\/p>\n<p><strong>4. \u5e94\u7528 \u4ece\u4e0d\u76f8\u5173\u7684\u672c\u5730\u4ed3\u5e93\u6765\u7684\u8865\u4e01<\/strong><br \/>\n\u5982\u679c\u4f60\u9700\u8981\u5176\u5b83\u4e00\u4e9b\u4e0d\u76f8\u5173\u7684\u672c\u5730\u4ed3\u5e93\u4f5c\u4e3a\u4f60\u73b0\u5728\u4ed3\u5e93\u7684\u8865\u4e01\uff0c\u8fd9\u91cc\u5c31\u662f\u901a\u5f80\u90a3\u91cc\u7684\u6377\u5f84\u3002<\/p>\n<p>git &#8211;git-dir=PATH_TO_OTHER_REPOSITORY_HERE\/.git format-patch -k -1 &#8211;stdout COMMIT_HASH_ID_HERE| git am -3 -k<\/p>\n<p><strong>5. \u68c0\u6d4b \u4f60\u7684\u5206\u652f\u7684\u6539\u53d8\u662f\u5426\u4e3a\u5176\u5b83\u5206\u652f\u7684\u4e00\u90e8\u5206<\/strong><br \/>\ncherry\u547d\u4ee4\u8ba9\u6211\u4eec\u68c0\u6d4b\u4f60\u7684\u5206\u652f\u7684\u6539\u53d8\u662f\u5426\u51fa\u73b0\u5728\u5176\u5b83\u4e00\u4e9b\u5206\u652f\u4e2d\u3002\u5b83\u901a\u8fc7+\u6216\u8005-\u7b26\u53f7\u6765\u663e\u793a\u4ece\u5f53\u524d\u5206\u652f\u4e0e\u6240\u7ed9\u7684\u5206\u652f\u4e4b\u95f4\u7684\u6539\u53d8\uff1a\u662f\u5426\u5408\u5e76\u4e86(merged)\u3002.+ \u6307\u793a\u6ca1\u6709\u51fa\u73b0\u5728\u6240\u7ed9\u5206\u652f\u4e2d\uff0c\u53cd\u4e4b\uff0c- \u5c31\u8868\u793a\u51fa\u73b0\u5728\u4e86\u6240\u7ed9\u7684\u5206\u652f\u4e2d\u4e86\u3002\u8fd9\u91cc\u5c31\u662f\u5982\u4f55\u53bb\u68c0\u6d4b\uff1a<\/p>\n<p>git cherry -v OTHER_BRANCH_NAME_HERE<\/p>\n<p>#\u4f8b\u5982: \u68c0\u6d4bmaster\u5206\u652f<\/p>\n<p>git cherry -v master<\/p>\n<p><strong>6.\u5f00\u59cb\u4e00\u4e2a\u65e0\u5386\u53f2\u7684\u65b0\u5206\u652f<\/strong><br \/>\n\u6709\u65f6\uff0c\u4f60\u9700\u8981\u5f00\u59cb\u4e00\u4e2a\u65b0\u5206\u652f\uff0c\u4f46\u662f\u53c8\u4e0d\u60f3\u628a\u5f88\u957f\u5f88\u957f\u7684\u5386\u53f2\u8bb0\u5f55\u5e26\u8fdb\u6765\uff0c\u4f8b\u5982\uff0c\u4f60\u60f3\u5728\u516c\u4f17\u533a\u57df\uff08\u5f00\u6e90\uff09\u653e\u7f6e\u4f60\u7684\u4ee3\u7801\uff0c\u4f46\u662f\u53c8\u4e0d\u60f3\u522b\u4eba\u77e5\u9053\u5b83\u7684\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<p>git checkout &#8211;orphan NEW_BRANCH_NAME_HERE<\/p>\n<p><strong>7. \u65e0\u5207\u6362\u5206\u652f\u7684\u4ece\u5176\u5b83\u5206\u652fCheckout\u6587\u4ef6<\/strong><\/p>\n<p>\u4e0d\u60f3\u5207\u6362\u5206\u652f\uff0c\u4f46\u662f\u53c8\u60f3\u4ece\u5176\u5b83\u5206\u652f\u4e2d\u83b7\u5f97\u4f60\u9700\u8981\u7684\u6587\u4ef6\uff1a<\/p>\n<p>git checkout BRANCH_NAME_HERE &#8212; PATH_TO_FILE_IN_BRANCH_HERE<\/p>\n<p><strong>8.\u5ffd\u7565\u5df2\u8ffd\u8e2a\u6587\u4ef6\u7684\u53d8\u52a8<\/strong><br \/>\n\u5982\u679c\u60a8\u6b63\u5728\u4e00\u4e2a\u56e2\u961f\u4e2d\u5de5\u4f5c\uff0c\u800c\u4e14\u5927\u5bb6\u90fd\u5728\u540c\u4e00\u6761branch\u4e0a\u9762\u5de5\u4f5c\uff0c\u90a3\u4e48\u60a8\u5f88\u6709\u53ef\u80fd\u4f1a\u7ecf\u5e38\u7528\u5230fetch\u548cmerge\u3002\u4f46\u662f\u6709\u65f6\u5019\u8fd9\u6837\u4f1a\u91cd\u7f6e\u60a8\u7684\u73af\u5883\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u6b64\u7684\u8bdd\uff0c\u60a8\u5c31\u5f97\u5728\u6bcf\u6b21merge\u540e\u4fee\u6539\u5b83\u3002\u4f7f\u7528\u8fd9\u4e00\u547d\u4ee4\uff0c\u60a8\u5c31\u80fd\u8981\u6c42git\u5ffd\u89c6\u6307\u5b9a\u6587\u4ef6\u7684\u53d8\u52a8\u3002\u8fd9\u6837\uff0c\u4e0b\u56de\u4f60\u518dmerge\u7684\u8bdd\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5c31\u4e0d\u4f1a\u88ab\u4fee\u6539\u4e86\u3002<\/p>\n<p>git update-index &#8211;assume-unchanged PATH_TO_FILE_HERE<\/p>\n<p><strong>9.\u68c0\u67e5\u63d0\u4ea4\u7684\u53d8\u52a8\u662f\u5426\u662frelease\u7684\u4e00\u90e8\u5206<\/strong><\/p>\n<p>name-rev\u547d\u4ee4\u80fd\u544a\u8bc9\u60a8\u4e00\u4e2acommit\u76f8\u5bf9\u4e8e\u6700\u8fd1\u4e00\u6b21release\u7684\u4f4d\u7f6e\u3002\u4f7f\u7528\u8fd9\u6761\u547d\u4ee4\uff0c\u60a8\u5c31\u53ef\u4ee5\u68c0\u67e5\u60a8\u6240\u505a\u51fa\u7684\u6539\u52a8\u662f\u5426\u662frelease\u7684\u4e00\u90e8\u5206\u4e86\u3002<\/p>\n<p>git name-rev &#8211;name-only COMMIT_HASH_HERE<\/p>\n<p><strong>10.\u4f7f\u7528rebase\u63a8\u9001\u800c\u975emerge<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u56e2\u961f\u4e2d\u5de5\u4f5c\u5e76\u4e14\u6574\u4e2a\u56e2\u961f\u90fd\u5728\u540c\u4e00\u6761branch\u4e0a\u9762\u5de5\u4f5c\uff0c\u90a3\u4e48\u60a8\u5c31\u5f97\u7ecf\u5e38\u5730\u8fdb\u884cfetch\/merge\u6216\u8005pull\u3002Git\u4e2d\uff0c\u5206\u652f\u7684\u5408\u5e76\u4ee5\u6240\u63d0\u4ea4\u7684merge\u6765\u8bb0\u5f55\uff0c\u4ee5\u6b64\u8868\u660e\u4e00\u6761feature\u5206\u652f\u4f55\u65f6\u4e0e\u4e3b\u5206\u652f\u5408\u5e76\u3002\u4f46\u662f\u5728\u591a\u56e2\u961f\u6210\u5458\u5171\u540c\u5de5\u4f5c\u4e8e\u4e00\u6761branch\u7684\u60c5\u5f62\u4e2d\uff0c\u5e38\u89c4\u7684merge\u4f1a\u5bfc\u81f4log\u4e2d\u51fa\u73b0\u591a\u6761\u6d88\u606f\uff0c\u4ece\u800c\u4ea7\u751f\u6df7\u6dc6\u3002\u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u5728pull\u7684\u65f6\u5019\u4f7f\u7528rebase\uff0c\u4ee5\u6b64\u6765\u51cf\u5c11\u65e0\u7528\u7684merge\u6d88\u606f\uff0c\u4ece\u800c\u4fdd\u6301\u5386\u53f2\u8bb0\u5f55\u7684\u6e05\u6670\u3002<\/p>\n<p>git pull &#8211;rebase<br \/>\n\u60a8\u4e5f\u53ef\u4ee5\u5c06\u67d0\u6761branch\u914d\u7f6e\u4e3a\u603b\u662f\u4f7f\u7528rebase\u63a8\u9001\uff1a<\/p>\n<p>git config branch.BRANCH_NAME_HERE.rebase true<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fc4\u4eca\uff0c\u6211\u5df2\u7ecf\u4f7f\u7528Git\u5f88\u957f\u4e00\u6bb5\u65f6\u95f4\u4e86\uff0c\u8003\u8651\u5206\u4eab\u4e00\u4e9b\u4e0d\u7ba1\u4f60\u662f\u56e2\u961f\u5f00\u53d1\u8fd8\u662f\u4e2a\u4eba\u9879\u76ee\uff0c\u90fd\u53d7\u7528\u7684\u9ad8\u7ea7git\u547d\u4ee4\u3002<\/p>\n<p><strong>1. \u8f93\u51fa\u6700\u540e\u4e00\u6b21\u63d0\u4ea4\u7684\u6539\u53d8<\/strong><br \/>\n\u8fd9\u4e2a\u547d\u4ee4\uff0c\u6211\u7ecf\u5e38\u4f7f\u7528\u5b83 \u6765\u53d1\u9001\u5176\u4ed6\u6ca1\u6709\u4f7f\u7528git\u7684\u4eba\u6765\u68c0\u67e5\u6216\u8005\u96c6\u6210\u6240\u4fee\u6539\u7684\u3002\u5b83\u4f1a\u8f93\u51fa\u6700\u8fd1\u63d0\u4ea4\u7684\u4fee\u6539\u5185\u5bb9\u5230\u4e00\u4e2azip\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>git archive -o ..\/updated.zip HEAD $(git diff &#8211;name-only HEAD^)<\/p>\n<p><strong>2. \u8f93\u51fa\u4e24\u4e2a\u63d0\u4ea4\u95f4\u7684\u6539\u53d8<\/strong><br \/>\n\u7c7b\u4f3c\u7684\uff0c\u5982\u679c\u4f60\u9700\u8981\u8f93\u51fa\u67d0\u4e24\u4e2a\u63d0\u4ea4\u95f4\u7684\u6539\u53d8\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u3002<\/p>\n<p>git archive -o ..\/latest.zip NEW_COMMIT_ID_HERE $(git diff &#8211;name-only OLD_COMMIT_ID_HERE NEW_COMMIT_ID_HERE)<\/p>\n<p><strong>3. \u514b\u9686 \u6307\u5b9a\u7684\u8fdc\u7a0b\u5206\u652f<\/strong><br \/>\n\u5982\u679c\u4f60\u6e34\u671b\u53ea\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93\u7684\u4e00\u4e2a\u6307\u5b9a\u5206\u652f\uff0c\u800c\u4e0d\u662f\u6574\u4e2a\u4ed3\u5e93\u5206\u652f\uff0c\u8fd9\u5bf9\u4f60\u5e2e\u52a9\u5f88\u5927\u3002<\/p>\n<p>git init<br \/>\ngit remote add -t BRANCH_NAME_HERE -f origin REMOTE_REPO_URL_PATH_HERE<br \/>\ngit checkout BRANCH_NAME_HERE<\/p>\n<p><strong>4. \u5e94\u7528 \u4ece\u4e0d\u76f8\u5173\u7684\u672c\u5730\u4ed3\u5e93\u6765\u7684\u8865\u4e01<\/strong><br \/>\n\u5982\u679c\u4f60\u9700\u8981\u5176\u5b83\u4e00\u4e9b\u4e0d\u76f8\u5173\u7684\u672c\u5730\u4ed3\u5e93\u4f5c\u4e3a\u4f60\u73b0\u5728\u4ed3\u5e93\u7684\u8865\u4e01\uff0c\u8fd9\u91cc\u5c31\u662f\u901a\u5f80\u90a3\u91cc\u7684\u6377\u5f84\u3002<\/p>\n<p>git &#8211;git-dir=PATH_TO_OTHER_REPOSITORY_HERE\/.git format-patch -k -1 &#8211;stdout COMMIT_HASH_ID_HERE| git am -3 -k<\/p>\n<p><strong>5. \u68c0\u6d4b \u4f60\u7684\u5206\u652f\u7684\u6539\u53d8\u662f\u5426\u4e3a\u5176\u5b83\u5206\u652f\u7684\u4e00\u90e8\u5206<\/strong><br \/>\ncherry\u547d\u4ee4\u8ba9\u6211\u4eec\u68c0\u6d4b\u4f60\u7684\u5206\u652f\u7684\u6539\u53d8\u662f\u5426\u51fa\u73b0\u5728\u5176\u5b83\u4e00\u4e9b\u5206\u652f\u4e2d\u3002\u5b83\u901a\u8fc7+\u6216\u8005-\u7b26\u53f7\u6765\u663e\u793a\u4ece\u5f53\u524d\u5206\u652f\u4e0e\u6240\u7ed9\u7684\u5206\u652f\u4e4b\u95f4\u7684\u6539\u53d8\uff1a\u662f\u5426\u5408\u5e76\u4e86(merged)\u3002.+ \u6307\u793a\u6ca1\u6709\u51fa\u73b0\u5728\u6240\u7ed9\u5206\u652f\u4e2d\uff0c\u53cd\u4e4b\uff0c- \u5c31\u8868\u793a\u51fa\u73b0\u5728\u4e86\u6240\u7ed9\u7684\u5206\u652f\u4e2d\u4e86\u3002\u8fd9\u91cc\u5c31\u662f\u5982\u4f55\u53bb\u68c0\u6d4b\uff1a<\/p>\n<p>git cherry -v OTHER_BRANCH_NAME_HERE<\/p>\n<p>#\u4f8b\u5982: \u68c0\u6d4bmaster\u5206\u652f<\/p>\n<p>git cherry -v master<\/p>\n<p><strong>6.\u5f00\u59cb\u4e00\u4e2a\u65e0\u5386\u53f2\u7684\u65b0\u5206\u652f<\/strong><br \/>\n\u6709\u65f6\uff0c\u4f60\u9700\u8981\u5f00\u59cb\u4e00\u4e2a\u65b0\u5206\u652f\uff0c\u4f46\u662f\u53c8\u4e0d\u60f3\u628a\u5f88\u957f\u5f88\u957f\u7684\u5386\u53f2\u8bb0\u5f55\u5e26\u8fdb\u6765\uff0c\u4f8b\u5982\uff0c\u4f60\u60f3\u5728\u516c\u4f17\u533a\u57df\uff08\u5f00\u6e90\uff09\u653e\u7f6e\u4f60\u7684\u4ee3\u7801\uff0c\u4f46\u662f\u53c8\u4e0d\u60f3\u522b\u4eba\u77e5\u9053\u5b83\u7684\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<p>git checkout &#8211;orphan NEW_BRANCH_NAME_HERE<\/p>\n<p><strong>7. \u65e0\u5207\u6362\u5206\u652f\u7684\u4ece\u5176\u5b83\u5206\u652fCheckout\u6587\u4ef6<\/strong><\/p>\n<p>\u4e0d\u60f3\u5207\u6362\u5206\u652f\uff0c\u4f46\u662f\u53c8\u60f3\u4ece\u5176\u5b83\u5206\u652f\u4e2d\u83b7\u5f97\u4f60\u9700\u8981\u7684\u6587\u4ef6\uff1a<\/p>\n<p>git checkout BRANCH_NAME_HERE &#8212; PATH_TO_FILE_IN_BRANCH_HERE<\/p>\n<p><strong>8.\u5ffd\u7565\u5df2\u8ffd\u8e2a\u6587\u4ef6\u7684\u53d8\u52a8<\/strong><br \/>\n\u5982\u679c\u60a8\u6b63\u5728\u4e00\u4e2a\u56e2\u961f\u4e2d\u5de5\u4f5c\uff0c\u800c\u4e14\u5927\u5bb6\u90fd\u5728\u540c\u4e00\u6761branch\u4e0a\u9762\u5de5\u4f5c\uff0c\u90a3\u4e48\u60a8\u5f88\u6709\u53ef\u80fd\u4f1a\u7ecf\u5e38\u7528\u5230fetch\u548cmerge\u3002\u4f46\u662f\u6709\u65f6\u5019\u8fd9\u6837\u4f1a\u91cd\u7f6e\u60a8\u7684\u73af\u5883\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u6b64\u7684\u8bdd\uff0c\u60a8\u5c31\u5f97\u5728\u6bcf\u6b21merge\u540e\u4fee\u6539\u5b83\u3002\u4f7f\u7528\u8fd9\u4e00\u547d\u4ee4\uff0c\u60a8\u5c31\u80fd\u8981\u6c42git\u5ffd\u89c6\u6307\u5b9a\u6587\u4ef6\u7684\u53d8\u52a8\u3002\u8fd9\u6837\uff0c\u4e0b\u56de\u4f60\u518dmerge\u7684\u8bdd\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5c31\u4e0d\u4f1a\u88ab\u4fee\u6539\u4e86\u3002<\/p>\n<p>git update-index &#8211;assume-unchanged PATH_TO_FILE_HERE<\/p>\n<p><strong>9.\u68c0\u67e5\u63d0\u4ea4\u7684\u53d8\u52a8\u662f\u5426\u662frelease\u7684\u4e00\u90e8\u5206<\/strong><\/p>\n<p>name-rev\u547d\u4ee4\u80fd\u544a\u8bc9\u60a8\u4e00\u4e2acommit\u76f8\u5bf9\u4e8e\u6700\u8fd1\u4e00\u6b21release\u7684\u4f4d\u7f6e\u3002\u4f7f\u7528\u8fd9\u6761\u547d\u4ee4\uff0c\u60a8\u5c31\u53ef\u4ee5\u68c0\u67e5\u60a8\u6240\u505a\u51fa\u7684\u6539\u52a8\u662f\u5426\u662frelease\u7684\u4e00\u90e8\u5206\u4e86\u3002<\/p>\n<p>git name-rev &#8211;name-only COMMIT_HASH_HERE<\/p>\n<p><strong>10.\u4f7f\u7528rebase\u63a8\u9001\u800c\u975emerge<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u56e2\u961f\u4e2d\u5de5\u4f5c\u5e76\u4e14\u6574\u4e2a\u56e2\u961f\u90fd\u5728\u540c\u4e00\u6761branch\u4e0a\u9762\u5de5\u4f5c\uff0c\u90a3\u4e48\u60a8\u5c31\u5f97\u7ecf\u5e38\u5730\u8fdb\u884cfetch\/merge\u6216\u8005pull\u3002Git\u4e2d\uff0c\u5206\u652f\u7684\u5408\u5e76\u4ee5\u6240\u63d0\u4ea4\u7684merge\u6765\u8bb0\u5f55\uff0c\u4ee5\u6b64\u8868\u660e\u4e00\u6761feature\u5206\u652f\u4f55\u65f6\u4e0e\u4e3b\u5206\u652f\u5408\u5e76\u3002\u4f46\u662f\u5728\u591a\u56e2\u961f\u6210\u5458\u5171\u540c\u5de5\u4f5c\u4e8e\u4e00\u6761branch\u7684\u60c5\u5f62\u4e2d\uff0c\u5e38\u89c4\u7684merge\u4f1a\u5bfc\u81f4log\u4e2d\u51fa\u73b0\u591a\u6761\u6d88\u606f\uff0c\u4ece\u800c\u4ea7\u751f\u6df7\u6dc6\u3002\u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u5728pull\u7684\u65f6\u5019\u4f7f\u7528rebase\uff0c\u4ee5\u6b64\u6765\u51cf\u5c11\u65e0\u7528\u7684merge\u6d88\u606f\uff0c\u4ece\u800c\u4fdd\u6301\u5386\u53f2\u8bb0\u5f55\u7684\u6e05\u6670\u3002<\/p>\n<p>git pull &#8211;rebase<br \/>\n\u60a8\u4e5f\u53ef\u4ee5\u5c06\u67d0\u6761branch\u914d\u7f6e\u4e3a\u603b\u662f\u4f7f\u7528rebase\u63a8\u9001\uff1a<\/p>\n<p>git config branch.BRANCH_NAME_HERE.rebase true<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[150,11],"tags":[],"class_list":["post-2611","post","type-post","status-publish","format-standard","hentry","category-git","category-11"],"_links":{"self":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2611"}],"version-history":[{"count":2,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2611\/revisions"}],"predecessor-version":[{"id":2613,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2611\/revisions\/2613"}],"wp:attachment":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2611"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}