{"id":146,"date":"2010-09-24T22:34:14","date_gmt":"2010-09-24T14:34:14","guid":{"rendered":"http:\/\/kaoru.tech\/?p=146"},"modified":"2011-02-27T22:47:21","modified_gmt":"2011-02-27T14:47:21","slug":"how-to-working-with-remote-repository","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=146","title":{"rendered":"\u7248\u672c\u63a7\u5236\uff0dGIT"},"content":{"rendered":"<h2>\u4ed3\u5e93\u6982\u5ff5<\/h2>\n<h3>\u7eaf\u4ed3\u5e93\u548c\u5de5\u4f5c\u4ed3\u5e93<\/h3>\n<p>\u4e00\u4e2aGit\u4ee3\u7801\u4ed3\u5e93\uff08repository\uff09\u53ef\u4ee5\u662f\u4e00\u4e2a\u7eaf\u4ed3\u5e93\uff08Bare repository\uff09\u6216\u8005\u662f\u4e00\u4e2a\u5f00\u53d1\u8005\u4ed3\u5e93(Development repository,\u00a0 nonbare)\u3002<br \/>\n\u5f00\u53d1\u8005\u4ed3\u5e93\u53ef\u4ee5\u7528\u4e8e\u666e\u901a\u7684\u65e5\u5e38\u5f00\u53d1\uff0c\u53cd\u4e4b\uff0c\u4e00\u4e2a\u7eaf\u4ed3\u5e93\u6ca1\u6709\u5de5\u4f5c\u76ee\u5f55\u5e76\u4e14\u4e0d\u80fd\u7528\u4e8e\u65e5\u5e38\u5f00\u53d1\u3002\u4e00\u4e2a\u7eaf\u4ed3\u5e93\u6ca1\u6709\u6838\u5b9e\uff08checked-out\uff09\u5206\u652f\uff08branch\uff09\u7684\u6982\u5ff5\uff0c\u6216\u8005\u8bf4\uff0c\u4f60\u4e0d\u80fd\u76f4\u63a5\u5bf9\u4e00\u4e2a\u7eaf\u4ed3\u5e93\u8fdb\u884c\u63d0\u4ea4\u3002<\/p>\n<p>\u4e00\u4e2a\u7eaf\u4ed3\u5e93\u770b\u8d77\u6765\u529f\u80fd\u5f88\u5c11\uff0c\u4f46\u662f\u5b83\u6781\u597d\u7684\u4e3a\u5408\u4f5c\u5f00\u53d1\u8005\u5145\u5f53\u4e3a\u53ef\u4fe1\u7684\u57fa\u7840\u3002\u5176\u4ed6\u7684\u5f00\u53d1\u8005\u4ece\u7eaf\u4ed3\u5e93clone\u3001etch\u5e76\u4e14\u5411\u5b83push\u66f4\u65b0\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6267\u884c<strong>git clone<\/strong>\u5e26\u4e86<strong>&#8211;bare<\/strong>\u53c2\u6570\uff0cGit\u5219\u521b\u5efa\u4e00\u4e2a\u7eaf\u4ed3\u5e93\uff0c\u5426\u5219\uff0c\u5219\u5efa\u7acb\u4e00\u4e2a\u5f00\u53d1\u8005\u4ed3\u5e93\u3002<\/p>\n<h3>\u4ed3\u5e93\u514b\u9686<\/h3>\n<p><strong>git clone<\/strong>\u547d\u4ee4\u53ef\u4ee5\u57fa\u4e8e\u4f60\u6307\u5b9a\u7684\u6e90\u4ed3\u5e93\u5efa\u7acb\u4e00\u4e2a\u65b0\u7684Git\u4ed3\u5e93\u3002Git\u4e0d\u4f1a\u590d\u5236\u6240\u6709\u6709\u5173\u6e90\u4ed3\u5e93\u7684\u6240\u6709\u4fe1\u606f\u3002<\/p>\n<p>\u5728\u901a\u5e38\u4f7f\u7528<strong>git clone<\/strong>\u540e\uff0c\u6e90\u4ed3\u5e93\u5b58\u4e8erefs\/heads\/\u7684\u5f00\u53d1\u8005\u7684\u5206\u652f\uff0c\u88abclone\u5230refs\/remotes\/\u4e0b\u6210\u4e3a\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002\u6e90\u4ed3\u5e93\u5728refs\/remotes\/\u4e0b\u7684\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u4e0d\u4f1a\u88abclone\u3002<\/p>\n<p>\u6765\u81ea\u4e8e\u6e90\u4ed3\u5e93\u7684\u6807\u7b7e\uff08Tags\uff09\u4e5f\u4f1a\u88ab\u62f7\u8d1d\u3002\u7136\u800c\u4ed3\u5e93\u7279\u6b8a\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u94a9\u5b50\uff08hook\uff09\u3001\u914d\u7f6e\u6587\u4ef6\u3001\u53c2\u8003\u65e5\u5fd7\u548c\u6e90\u4ed3\u5e93\u9690\u85cf\u7684\u4e0d\u4f1a\u88ab\u590d\u5236\u3002<\/p>\n<pre lang=\"unix\">git clone git@compile.3322.org:testing.git testing.git<\/pre>\n<p>\u8fd9\u91cc\uff0cgit@compile.3322.org:testing.git\u88ab\u8ba4\u4e3a\u662f\u6e90\u4ed3\u5e93\u3001\u8fdc\u7a0b\u4ed3\u5e93\uff08remote repository\uff09\uff0c\u65b0\u7684\uff0cclone\u7ed3\u679c\u662ftesting.git\u3002<br \/>\n\u9ed8\u8ba4\u6bcf\u4e2aclone\u7684\u4ed3\u5e93\u901a\u8fc7\u4e00\u4e2a\u53eb\u505aorigin\u7684\u8fdc\u7a0b\u5206\u652f\u7ef4\u62a4\u5230\u5b83\u7684\u7236\u4ed3\u5e93\u7684\u94fe\u63a5\u3002\u540d\u5b57&#8221;origin&#8221;\u4e0d\u662f\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\u5fc5\u987b\u7684\u3002\u5982\u679c\u4f60\u4e0d\u50cf\u4f7f\u7528\u5b83\uff0c\u5728\u505aclone\u64cd\u4f5c\u7684\u65f6\u5019\u52a0\u4e00\u4e2a<strong>&#8211;origin name<\/strong>\u7684\u9009\u9879\u5373\u53ef\u3002<\/p>\n<p>Git\u540c\u65f6\u5bf9\u9ed8\u8ba4\u7684origin\u8fdc\u7a0b\u4ed3\u5e93\u914d\u7f6e\u4e86\u9ed8\u8ba4\u7684fetch refspec\uff1a<\/p>\n<pre lang=\"vim\">fetch = +refs\/heads\/*:refs\/remote\/origin\/*<\/pre>\n<p>\u5efa\u7acb\u8fd9\u4e2arefspec\u9884\u6d4b\u4f60\u4f1a\u60f3\u901a\u8fc7\u4ece\u6e90\u4ed3\u5e93\u83b7\u5f97\u4fee\u6539\u6765\u66f4\u65b0\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u3002<\/p>\n<h3>\u8fdc\u7a0b\u4ed3\u5e93\uff08Remotes\uff09<\/h3>\n<p>\u4f60\u5f53\u524d\u5de5\u4f5c\u7684\u4ed3\u5e93\u88ab\u79f0\u4e3a\u672c\u5730\uff08local\uff09\u6216\u5f53\u524d\uff08current\uff09\u4ed3\u5e93\uff0c\u540c\u65f6\uff0c\u4f60\u60f3\u8981\u4ea4\u4e92\u6587\u4ef6\u7684\u4ed3\u5e93\u88ab\u79f0\u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u3002\u4f46\u662f\u540e\u9762\u7684\u672f\u8bed\u6709\u70b9\u4f7f\u7528\u4e0d\u5f53\uff0c\u56e0\u4e3a\u4ed3\u5e93\u53ef\u80fd\u4e0d\u5728\u7269\u7406\u4e0a\u7684\u8fdc\u7a0b\u6216\u8005\u53e6\u5916\u4e00\u53f0\u673a\u5668\uff0c\u5b83\u53ef\u4ee5\u662f\u4e00\u4e2a\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u5176\u4ed6\u7684\u4e00\u4e2a\u4ed3\u5e93\u3002<\/p>\n<p>Git\u540c\u65f6\u4f7f\u7528\u8fdc\u7a0b\u4ed3\u5e93\u548c\u8ddf\u8e2a\uff08tracking\uff09\u5206\u652f\u4f5c\u4e3a\u65b9\u4fbf\u8fde\u63a5\u5176\u4ed6\u4ed3\u5e93\u7684\u53c2\u8003\u5f15\u7528\u3002remote\u4e3a\u4ed3\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e2a\u53cb\u597d\u7684\u540d\u5b57\u5e76\u7528\u6765\u4ee3\u66ff\u5b9e\u9645\u7684\u4ed3\u5e93URL\u3002\u4e00\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u5bf9\u4e8e\u672c\u5730\u4ed3\u5e93\u7ec4\u6210\u4e86\u8ddf\u8e2a\u5206\u652f\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<p>\u4f7f\u7528<strong>git remote<\/strong>\u547d\u4ee4\u53ef\u4ee5\u521b\u5efa\u3001\u542f\u52a8\u3001\u64cd\u505a\u548c\u67e5\u770b\u4e00\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u3002\u6240\u6709\u5f15\u5165\u7684\u8fdc\u7a0b\u4ed3\u5e93\u90fd\u88ab\u8bb0\u5f55\u5728.git\/config\u6587\u4ef6\u5e76\u53ef\u4ee5\u4f7f\u7528<strong>git config<\/strong>\u64cd\u4f5c\u3002<\/p>\n<p>\u9664\u4e86<strong>git clone<\/strong>\uff0c\u5176\u4ed6\u548c\u8fdc\u7a0b\u4ed3\u5e93\u5e38\u7528\u7684Git\u547d\u4ee4\u662f\uff1a<\/p>\n<pre lang=\"unix\">git fetch\r\n    \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u68c0\u7d22\u5bf9\u8c61\u548c\u5b83\u4eec\u76f8\u5173\u7684\u7684\u5143\u6570\u636e\uff08metadata\uff09\r\ngit pull\r\n    \u50cfgit fetch\uff0c\u4f46\u662f\u540c\u65f6\u5e76\u5165\uff08merge\uff09\u5230\u5bf9\u5e94\u7684\u5206\u652f\r\ngit push\r\n    \u4f20\u9001\u5bf9\u8c61\u548c\u5b83\u4eec\u76f8\u5173\u7684\u7684\u5143\u6570\u636e\u5230\u8fdc\u7a0b\u4ed3\u5e93\r\ngit ls-remote\r\n    \u663e\u793a\u8fdc\u7a0b\u4ed3\u5e93\u5185\u7684\u6240\u6709\u5f15\u7528\u53c2\u8003<\/pre>\n<h3>\u8ddf\u8e2a\u5206\u652f<\/h3>\n<p>\u4e00\u65e6clone\u4e00\u4e2a\u4ed3\u5e93\uff0c\u5373\u4f7f\u4f60\u4ea7\u751f\u672c\u5730\u63d0\u4ea4\uff08commit\uff09\u6216\u8005\u521b\u5efa\u672c\u5730\u5206\u652f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8ddf\u4e0a\uff08keep up with\uff09\u6e90\u4ed3\u5e93\u7684\u4fee\u6b63\u3002\u5b9e\u9645\u4e0a\uff0c\u4f60\u53ef\u4ee5\u5efa\u7acb\u4e00\u4e2a\u540d\u4e3atestd\u7684\u672c\u5730\u5206\u652f\u800c\u4e0d\u9700\u8981\u786e\u8ba4\u6709\u5f00\u53d1\u8005\u5728\u4e0a\u5de5\u4f5c\uff0c\u6216\u8005\u6e90\u4ed3\u5e93\u4e5f\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2atest\u5206\u652f\u3002\u901a\u8fc7\u8ddf\u8e2a\u5206\u652f\uff0cGit\u5141\u8bb8\u57282\u4e2atest\u5206\u652f\u8ddf\u8e2a\u53d1\u5c55\u3002<\/p>\n<p>\u5728\u4e00\u4e2aclone\u64cd\u4f5c\u540e\uff0cGit\u5bf9\u6e90\u4ed3\u5e93\u7684\u6bcf\u4e2a\u5f53\u524d\u5206\u652f\u5728\u672c\u5730\u4ed3\u5e93\u5efa\u7acb\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002\u672c\u5730\u4ed3\u5e93\u4f7f\u7528\u5b83\u7684\u8ddf\u8e2a\u5206\u652f\u8ffd\u968f\u53d1\u751f\u5728\u6e90\u4ed3\u5e93\u7684\u53d8\u5316\u3002<\/p>\n<h2>\u53c2\u8003\u5176\u4ed6\u4ed3\u5e93<\/h2>\n<p>\u4e3a\u4e86\u4f7f\u4f60\u7684\u4ed3\u5e93\u548c\u5176\u4ed6\u4ed3\u5e93\u540c\u6b65\u5de5\u4f5c\uff0c\u4f60\u9700\u8981\u5b9a\u4e49\u4e00\u4e2aremote\u3002\u4e00\u4e2aremote\u662f\u5b58\u5728\u4ed3\u5e93\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u547d\u540d\u8282\u70b9\u3002\u5b83\u5305\u542b2\u90e8\u5206\u3002\u7b2c\u4e00\u90e8\u5206\u4ee5URL\u7684\u65b9\u5f0f\u786e\u5b9a\u4e86\u53e6\u4e00\u4e2a\u4ed3\u5e93\u7684\u540d\u5b57\u3002\u7b2c\u4e8c\u90e8\u5206\uff0c\u79f0\u4e3arefspec\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2aref\uff08\u901a\u5e38\u662f\u4e00\u4e2a\u5206\u652f\uff09\u5982\u4f55\u4ece\u4e00\u4e2a\u4ed3\u5e93\u7684\u547d\u540d\u7a7a\u95f4\u6620\u5c04\u5230\u53e6\u4e00\u4e2a\u4ed3\u5e93\u7684\u547d\u540d\u7a7a\u95f4\u3002<\/p>\n<h3>\u53c2\u8003\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/h3>\n<p>Git\u652f\u6301\u591a\u79cd\u5f62\u5f0f\u7684URL\u65b9\u5f0f\u547d\u540d\u8fdc\u7a0b\u4ed3\u5e93\u3002\u8fd9\u4e9b\u5f62\u5f0f\u6307\u660e\u4e86\u8bbf\u95ee\u534f\u8bae\u548c\u6570\u636e\u7684\u5730\u5740\u3002<\/p>\n<p>\u6700\u7b80\u5355\u7684Git URL\u5f62\u5f0f\u6307\u5411\u4e00\u4e2a\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4ed3\u5e93\u3002\u67092\u79cd\u65b9\u5f0f\uff1a<\/p>\n<pre lang=\"vim\">\/path\/to\/repo.git\r\nfile:\/\/\/path\/to\/repo.git<\/pre>\n<p>\u5982\u679c\u4f60\u9700\u8981\u901a\u8fc7\u7f51\u7edc\u4ece\u4e00\u4e2a\u771f\u5b9e\u7684\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u5f97\u6570\u636e\uff0c\u6700\u6709\u6548\u7684\u65b9\u6cd5\u88ab\u79f0\u4e3aGit\u672c\u5730\u534f\u8bae\uff08Git native protocol\uff09\uff0c\u4f8b\u5982<\/p>\n<pre lang=\"vim\">git:\/\/example.com\/path\/to\/repo.git\r\ngit:\/\/example.com\/~user\/path\/to\/repo.git<\/pre>\n<p><em>git-daemon<\/em>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u53d1\u5e03\u4ed3\u5e93\u63d0\u4f9b\u533f\u540d\u8bfb\u53d6\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u79cdURL\u65b9\u5f0fclone\u6216\u8005fetch\u3002<\/p>\n<p>\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u7684\u5ba2\u6237\u7aef\u662f\u65e0\u8ba4\u8bc1\u7684\uff0c\u4e0d\u9700\u8981\u5bc6\u7801\u3002\u800c\u4e14\uff0c<em>~user<\/em>\u683c\u5f0f\u88ab\u6307\u5411\u5230\u7528\u6237\u4e3b\u76ee\u5f55\u3002\u4e00\u4e2a\u5355\u72ec\u7684~\u6ca1\u6709\u4efb\u4f55\u610f\u4e49\u3002\u6b64\u5916\uff0c<em>~user<\/em>\u65b9\u5f0f\u53ea\u5728\u670d\u52a1\u5668\u7aef\u4f7f\u7528<em>&#8211;user-path<\/em>\u53c2\u6570\u4f7f\u80fd\u8bbf\u95ee\u3002<\/p>\n<p>\u4e3a\u4e86\u5b89\u5168\uff0c\u7ecf\u8fc7\u8ba4\u8bc1\u8fde\u63a5\uff0cGit\u672c\u5730\u534f\u8bae\u53ef\u4ee5\u88ab\u8f6c\u6210\u4e00\u4e2a\u4f7f\u7528\u4ee5\u4e0b\u5f62\u5f0f\u7684SSH\u8fde\u63a5\uff1a<\/p>\n<pre lang=\"vim\">ssh:\/\/\/[user@]example.com[:port]\/path\/to\/repo.git\r\nssh:\/\/[user@]example.com\/path\/to\/repo.git\r\nssh:\/\/[user@]example.com\/~user2\/path\/to\/repo.git\r\nssh:\/\/[user@]example.com\/~\/path\/to\/repo.git<\/pre>\n<p>Git\u4e5f\u63d0\u4f9b\u4e86\u7c7b\u4f3cscp\u8bed\u6cd5\u7684URL\u683c\u5f0f\u3002\u5b83\u548cSSH\u683c\u5f0f\u4e00\u6837\uff0c\u4f46\u662f\u4e0d\u80fd\u6307\u5b9a\u7aef\u53e3\u53c2\u6570\uff1a<\/p>\n<pre lang=\"vim\">[user@]example.com:\/path\/to\/repo.git\r\n[user@]example.com:~user\/path\/to\/repo.git\r\n[user@]example.com:path\/to\/repo.git<\/pre>\n<p>HTTP\u548cHTTPS URL\u53d8\u4f53\u4e5f\u5b8c\u5168\u652f\u6301\uff0c\u5c3d\u7ba1\u4efb\u4f55\u4e00\u4e2a\u90fd\u6ca1\u6709Git\u672c\u5730\u534f\u8bae\u6709\u6548\u7387\u3002<\/p>\n<pre lang=\"vim\">http:\/\/example.com\/path\/to\/repo.git\r\nhttps:\/\/example.com\/path\/to\/repo.git<\/pre>\n<p>\u6700\u540e\uff0crsync\u534f\u8bae\u540c\u6837\u652f\u6301\uff1a<\/p>\n<pre lang=\"vim\">rsync:\/\/example.com\/path\/to\/repo.git<\/pre>\n<h3>\u53c2\u8003\u8bf4\u660e\uff08refspec\uff09<\/h3>\n<p>\u901a\u5e38\u4e00\u4e2aref\u662f\u4e00\u4e2a\u5206\u652f\u7684\u540d\u5b57\u3002\u4e00\u4e2arefspec\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u6620\u5c04\u5230\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u7684\u5206\u652f\u3002<\/p>\n<p>\u5728\u4e00\u4e2arefspec\uff0c\u4f60\u901a\u5e38\u770b\u5230\u5f00\u53d1\u8005\u5206\u652f\u7684\u540d\u5b57\u6709<em>refs\/heads\/<\/em>\u524d\u7f00\u5e76\u4e14\u88ab\u8ddf\u8e2a\u7684\u5206\u652f\u540d\u5b57\u6709<em>refs\/remotes\/<\/em>\u524d\u7f00\u3002<\/p>\n<p>refspec\u7684\u8bed\u6cd5\u662f\uff1a<\/p>\n<pre lang=\"vim\">[+]source:destination<\/pre>\n<p>\u5b83\u4e3b\u8981\u7531\u4e00\u4e2a\u6e90ref\uff0c\u4e00\u4e2a\u5192\u53f7\u548c\u4e00\u4e2a\u76ee\u7684ref\u7ec4\u6210\u3002\u5b8c\u6574\u683c\u5f0f\u53ef\u4ee5\u6709\u4e00\u4e2a\u53ef\u9009\u7684\u52a0\u53f7\u3002\u52a0\u53f7\u6307\u5728\u4f20\u8f93\u4e2d\u666e\u901a\u7684fast-forward\u5b89\u5168\u68c0\u67e5\u4e0d\u4f1a\u88ab\u6267\u884c\u3002\u6b64\u5916\uff0c\u4e00\u4e2a\u661f\u53f7\u662f\u5339\u914d\u6240\u6709\u5206\u652f\u540d\u5b57\u7684\u901a\u914d\u7b26\u3002<\/p>\n<p>\u6709\u65f6\uff0c\u6e90ref\u662f\u53ef\u9009\u7684\uff0c\u5192\u53f7\u548c\u76ee\u7684ref\u4e5f\u662f\u53ef\u9009\u7684\u3002<\/p>\n<p>\u4f7f\u7528refspec\u7684\u6280\u5de7\u662f\u7406\u89e3\u5b83\u6240\u6307\u5b9a\u7684\u6570\u636e\u6d41\u5411\u3002refspec\u901a\u5e38\u4e3a<em>source:destination<\/em>\u3002\u4f46\u662f\u6e90\u548c\u76ee\u7684\u7684\u89d2\u8272\u53d6\u51b3\u4e8e\u6267\u884c\u7684Git\u64cd\u4f5c\u3002\u5173\u7cfb\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"vim\">\u64cd\u4f5c    \u6e90               \u76ee\u7684\r\npush   \u672c\u5730ref\u88abpush     \u8fdc\u7a0bref\u88ab\u66f4\u65b0\r\nfetch  \u8fdc\u7a0bref\u88abfetch    \u672c\u5730ref\u88ab\u66f4\u65b0<\/pre>\n<p>\u4e00\u4e2a\u5178\u578b\u7684<strong>git fetch<\/strong>\u547d\u4ee4\u4f7f\u7528\u5982\u4e0b\u7684refspec\uff1a<\/p>\n<pre lang=\"vim\">+refs\/heads\/*:refs\/remotes\/remote\/*<\/pre>\n<p>\u8fd9\u4e2arefspec\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n<p style=\"padding-left: 30px;\">\u6240\u6709\u6765\u81ea\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5728<em>refs\/heads\/<\/em>\u547d\u540d\u7a7a\u95f4\u7684\u539f\u5206\u652f\u6620\u5c04\u5230\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u3002\u8fdc\u7a0b\u540d\u5b57\u653e\u5165<em>refs\/remotes\/remote<\/em>\u547d\u540d\u7a7a\u95f4\u3002<\/p>\n<p>\u56e0\u4e3a\u6709\u661f\u53f7\uff0c\u8fd9\u4e2arefspec\u5e94\u7528\u5728\u8fdc\u7a0b\u7684<em>refs\/heads\/*<\/em>\u627e\u5230\u7684\u6240\u6709\u5206\u652f\u3002<\/p>\n<p>refspec\u53ef\u4ee5\u88ab<strong>git fetch<\/strong>\u548c<strong>git push<\/strong>\u4f7f\u7528\u3002\u56e0\u4e3a<strong>git pull<\/strong>\u7684\u7b2c\u4e00\u6b65\u662f<strong>fetch<\/strong>\uff0cfetch refspec\u7b49\u540c\u4e0e<strong>git pull<\/strong>\u3002<\/p>\n<p>\u901a\u8fc7<strong>git push<\/strong>\u64cd\u4f5c\uff0c\u4f60\u60f3\u63d0\u4f9b\u548c\u53d1\u5e03\u5728\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u4e0a\u4f5c\u51fa\u7684\u4fee\u6539\u3002\u4e3a\u4e86\u5728\u4f60\u4e0a\u4f20\u4e4b\u540e\u5141\u8bb8\u5176\u4ed6\u4eba\u627e\u5230\u4f60\u7684\u4fee\u6539\uff0c\u4f60\u7684\u4fee\u6539\u5fc5\u987b\u4f5c\u4e3a\u4e3b\u5206\u652f\u51fa\u73b0\u5728\u4ed3\u5e93\u3002\u56e0\u6b64\uff0c\u901a\u8fc7<strong>git push<\/strong>\u64cd\u4f5c\uff0c\u6765\u81ea\u4f60\u7684\u4ed3\u5e93\u7684\u6e90\u5206\u652f\u901a\u8fc7\u4f7f\u7528\u5982\u4e0brefspec\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n<pre lang=\"vim\">+refs\/heads\/*:refs\/heads\/*<\/pre>\n<p>\u8fd9\u4e2arefspec\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n<p style=\"padding-left: 30px;\">\u4ece\u672c\u5730\u4ed3\u5e93\uff0c\u627e\u5230\u539f\u547d\u540d\u7a7a\u95f4<em>refs\/heads\/<\/em>\u4e0b\u627e\u5230\u7684\u6240\u6709\u5206\u652f\uff0c\u653e\u5165\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u76ee\u7684\u547d\u540d\u7a7a\u95f4<em>refs\/heads\/<\/em>\u4e0b\u7684\u6709\u76f8\u540c\u540d\u5b57\u7684\u5339\u914d\u7684\u5206\u652f\u3002<\/p>\n<p>\u7b2c\u4e00\u4e2a<em>refs\/heads\/<\/em>\u6307\u7684\u662f\u4f60\u7684\u672c\u5730\u4ed3\u5e93\uff08\u56e0\u4e3a\u4f60\u5728\u505apush\u64cd\u4f5c\uff09\uff0c\u7b2c\u4e8c\u4e2a\u6307\u7684\u662f\u8fdc\u7a0b\u4ed3\u5e93\u3002\u661f\u53f7\u4fdd\u8bc1\u6240\u6709\u7684\u5206\u652f\u88ab\u590d\u5236\u3002<\/p>\n<h2>\u4f7f\u7528\u8fdc\u7a0b\u4ed3\u5e93\u4f8b\u5b50<\/h2>\n<h2>\u53c2\u8003\u8d44\u6599<\/h2>\n<ul>\n<li>Reilly.Version.Control.with.Git.2009.pdf<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528GIT\u7ba1\u7406\u4ee3\u7801\uff0c\u57fa\u672c\u7ffb\u8bd1\u81eaReilly.Version.Control.with.Git.2009.pdf<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[31],"tags":[214,83,82],"class_list":["post-146","post","type-post","status-publish","format-standard","hentry","category-git","tag-git","tag-reilly","tag-translate"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=146"}],"version-history":[{"count":18,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":743,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/146\/revisions\/743"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}