{"id":585,"date":"2011-01-04T12:36:56","date_gmt":"2011-01-04T17:36:56","guid":{"rendered":"httpss:\/\/www.powenko.com\/wordpress\/?p=585"},"modified":"2011-01-05T03:12:54","modified_gmt":"2011-01-05T08:12:54","slug":"%e4%bd%bf%e7%94%a8git%e8%88%87github%e7%ae%a1%e7%90%86%e8%bb%9f%e9%ab%94%e9%96%8b%e7%99%bc%e5%b0%88%e6%a1%88","status":"publish","type":"post","link":"https:\/\/www.powenko.com\/wordpress\/?p=585","title":{"rendered":"\u4f7f\u7528Git\u8207Github\u7ba1\u7406\u8edf\u9ad4\u958b\u767c\u5c08\u6848"},"content":{"rendered":"<h2><a rel=\"attachment wp-att-586\" href=\"httpss:\/\/www.powenko.com\/wordpress\/?attachment_id=586\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-586\" title=\"Screen shot 2011-01-04 at 9.35.57 AM\" src=\"httpss:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-300x173.png\" alt=\"\" width=\"300\" height=\"173\" srcset=\"https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-300x173.png 300w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-570x329.png 570w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-316x182.png 316w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-120x69.png 120w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-210x121.png 210w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-496x286.png 496w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM-140x81.png 140w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2011\/01\/Screen-shot-2011-01-04-at-9.35.57-AM.png 968w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/h2>\n<h2>\u4e2d\u6587\u4f7f\u7528\u4ecb\u7d39\uff1a<\/h2>\n<h3>Github<\/h3>\n<p>httpss:\/\/sls.weco.net\/blog\/porsche780209\/04-jun-2009\/12980<\/p>\n<p>httpss:\/\/billy3321.blogspot.com\/2009\/02\/github-howto.html<\/p>\n<h3>Git \u521d\u5b78\u7b46\u8a18 &#8211; \u6307\u4ee4\u64cd\u4f5c\u6559\u5b78<\/h3>\n<p>httpss:\/\/plog.longwin.com.tw\/my_note-unix\/2009\/05\/19\/git-learn-initial-command-2009<\/p>\n<p>\u6587\u7ae0\u4f86\u6e90 \uff1ahttpss:\/\/billy3321.blogspot.com\/2009\/02\/github-howto.html<\/p>\n<h2>\u4f7f\u7528Git\u8207Github\u7ba1\u7406\u8edf\u9ad4\u958b\u767c\u5c08\u6848<\/h2>\n<pre>httpss:\/\/zh-tw.whygitisbetterthanx.com\/#github<\/pre>\n<p>\u4e4b\u524d\u807d\u805egit\u9019\u500b\u7248\u672c\u63a7\u5236\u6642\uff0c\u770b\u5230\u6709\u4eba\u4ecb\u7d39github\u9019\u500b\u670d\u52d9\u3002<!--more--><br \/>\nhttpsss:\/\/github.com\/<br \/>\ngit\u662f\u500b\u5206\u6563\u5f0f\u7684\u7248\u672c\u63a7\u5236\u8edf\u9ad4\u3002\u5927\u90e8\u5206\u7684\u7248\u672c\u63a7\u5236\u8edf\u9ad4\u90fd\u9700\u8981\u4e00\u500b\u4f3a\u670d\u7aef\uff0c\u5728commit\u7684\u540c\u6642\uff0c\u63d0\u4ea4\u5230\u4f3a\u670d\u5668\u4e0a\u9762\u3002git\u7576\u7136\u4e5f\u53ef\u4ee5\u96c6\u4e2d\u7ba1\u7406\uff0c\u4f46\u662f\u4ed6\u53e6\u5916\u591a\u4e86\u5206\u6563\u7ba1\u7406\u7684\u65b9\u5f0f\u3002\u7c21\u55ae\u4f86\u8aaa\uff0cbilly\u958b\u4e86\u4e00\u500b\u5c08\u6848\uff0ctom\u89ba\u5f97\u9019\u500b\u5c08\u6848\u6709\u610f\u601d\uff0c\u4ed6\u60f3\u73a9\u73a9\u770b\uff0c\u4ed6\u53ef\u4ee5\u628a\u6574\u500brepo(reoisitories)\u90fdclone\u904e\u53bb\uff0c\u4e26\u4e14\u5728\u4ed6\u90a3\u908a\u81ea\u5df1\u6709\u4e00\u500brepo\u3002tom\u53ef\u4ee5\u81ea\u7531\u7684\u5c0d\u9019\u500brepo\u505a\u5404\u7a2e\u63d0\u4ea4\u4fee\u6539\uff0c\u76f4\u5230\u4ed6\u89ba\u5f97\u6eff\u610f\u70ba\u6b62\u3002\u9019\u6642\u5019tom\u53ef\u4ee5\u544a\u8a34billy\uff0c\u4ed6\u6539\u4e86\u4e00\u4e9b\u4ec0\u9ebc\uff0c\u82e5billy\u89ba\u5f97\u4e0d\u932f\uff0c\u53ef\u4ee5\u5f9etom\u90a3\u908afetch\u56de\u53bb\u4e26merge\u3002<\/p>\n<p>\u7531\u65bcrepo\u53ef\u4ee5\u7d81\u5728\u5beb\u7a0b\u5f0f\u7684\u4eba\u8eab\u4e0a\uff0c\u4e0d\u7528\u4e00\u5b9a\u8981\u6709\u4e2d\u592e\u4f3a\u670d\u5668\u7684\u4e3b\u5f9e\u67b6\u69cb\uff0c\u56e0\u6b64\u5c31\u51fa\u73fe\u4e86github\u9019\u500b\u7db2\u7ad9\u3002github\u662f\u7528ruby\u5beb\u7684\uff0c\u4e0a\u9762\u7684ruby\u5c08\u6848\u4e5f\u975e\u5e38\u6d3b\u8e8d\u3002github\u4e2d\uff0c\u6bcf\u500b\u4eba\u90fd\u53ef\u4ee5\u6709\u591a\u500brepo\uff0c\u9019\u4e9brepo\u90fd\u662f\u7d81\u5728user\u4e0a\u7684\u3002user\u4e4b\u9593\u53ef\u4ee5\u4e92\u76f8clone repo\uff0cwatch repo\uff0c\u6216\u662f follow \u5176\u4ed6 user\uff0c\u5c31\u597d\u50cftwitter\u6216\u662fplurk\u9019\u4e9b\u793e\u4ea4\u7db2\u7ad9\u4e00\u6a23\u3002<\/p>\n<p>\u4e0d\u904e\u82e5\u8981\u514d\u8cbb\u4f7f\u7528github\uff0c\u6240\u6709\u7684repo\u90fd\u8981public\u3002\u82e5\u5e0c\u671b\u6709private\u7684repo\uff0c\u5247\u8981\u8ddfgithub\u4ed8\u8cbb\u624d\u53ef\u64c1\u6709\u3002\u800cgithub\u53e6\u5916\u6709\u526a\u8cbc\u7c3f\u7684\u529f\u80fd\uff0c\u53ef\u5c07\u7a0b\u5f0f\u78bc\u8cbc\u65bc\u5176\u4e2d\uff0c\u4e26\u81ea\u7531\u7684\u767c\u5c55\u5404\u7a2ebranch\u3002<br \/>\n\u5982\u4ee5\u4e0b\u9023\u7d50\uff1ahttpss:\/\/gist.github.com\/37915<\/p>\n<p>\u9019\u908a\u7c21\u55ae\u4ecb\u7d39\u4e00\u4e0bgit\uff0c\u518d\u7c21\u55ae\u4ecb\u7d39\u4e00\u4e0b\u5982\u4f55\u5728github\u4e0a\u9762\u7ba1\u7406\u4e26\u958b\u555f\u4e00\u500b\u5c08\u6848\u3002<\/p>\n<p>\u7248\u672c\u63a7\u5236\u7cfb\u7d71\u4e4b\u6240\u4ee5\u5b58\u5728\uff0c\u4e3b\u8981\u662f\u70ba\u4e86\u958b\u767c\u8edf\u9ad4\uff0c\u4e26\u907f\u514d\u591a\u4eba\u540c\u6642\u7de8\u8f2f\u540c\u4e00\u6a94\u6848\u9020\u6210\u7684\u6df7\u4e82\u8207\u56f0\u64fe\u3002\u9019\u908a\u6709\u4e00\u500bsubversion\u7684\u7dda\u4e0a\u4e2d\u6587\u6587\u4ef6\uff0c\u96d6\u7136\u662f\u4e0d\u540c\u8edf\u9ad4\uff0c\u4f46\u662f\u5728\u7248\u672c\u63a7\u5236\u7684\u6838\u5fc3\u6982\u5ff5\u4e0a\u4e26\u7121\u4e8c\u81f4\u3002<br \/>\nhttpss:\/\/twpug.net\/docs\/Subversion\/<\/p>\n<p>\u9996\u5148\u5148\u4f86\u4ecb\u7d39\u5982\u4f55\u5c07\u74b0\u5883\u5efa\u7f6e\u597d\u3002<br \/>\n\u5efa\u7f6e\u74b0\u5883\u5206\u70ba\u4e09\u500b\u6b65\u9a5f\uff0c\u5b89\u88dd\u8207\u8a2d\u5b9agit\uff0c\u5b89\u88dd\u8207\u8a2d\u5b9assh-key\uff0c\u4ee5\u53ca\u5728github\u4e0a\u8a3b\u518a\uff0c\u4e26\u5efa\u7acb\u4e00\u500brepo\u3002<\/p>\n<p>1.\u5b89\u88dd\u8207\u8a2d\u5b9agit<br \/>\nLinux:<br \/>\n\u53ea\u8981\u7528yum\uff0capt-get\u7b49\u5404\u7a2e\u5957\u4ef6\u670d\u52d9\u5c0b\u627e\u4e26\u5b89\u88ddgit\uff0c\u6216\u662fgit-core\u5373\u53ef\u3002<\/p>\n<p>Mac OS X<br \/>\n\u8acb\u5728\u9019\u908a\u6293\u53d6\u5b89\u88dd\u6a94\u6848\u4e26\u5b89\u88dd\u4e4b<br \/>\nhttpss:\/\/code.google.com\/p\/git-osx-installer\/<\/p>\n<p>Windows<br \/>\n\u8acb\u5148\u6293\u53d6putty-installer\u5b89\u88dd\uff0c\u6216\u81f3\u5c11\u6293\u53d6plink.exe<br \/>\nhttpss:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html<br \/>\n\u63a5\u4e0b\u4f86\u6293\u53d6msysgit\u7684\u5b89\u88dd\u6a94<br \/>\nhttpss:\/\/code.google.com\/p\/msysgit\/downloads\/list<\/p>\n<p>\u5b89\u88dd\u6642\uff0c\u9078\u64c7\u4f7f\u7528Plink\uff0c\u4e26\u5f9eputty\u5b89\u88dd\u8cc7\u6599\u593e\u6216plink.exe\u6240\u5728\u8cc7\u6599\u593e\u9ede\u9078plink\u3002<\/p>\n<p>2.\u8a2d\u5b9a\u8207\u4e0a\u50b3ssh key<\/p>\n<p>git\u4f7f\u7528ssh tunnel\u4f86\u50b3\u905e\u539f\u59cb\u78bc\uff0c\u9019\u500b\u52a0\u5bc6\u901a\u9053\u53ef\u4ee5\u907f\u514d\u539f\u59cb\u78bc\u7684\u5c01\u5305\u88ab\u6514\u622a\u800c\u7aca\u53d6\u3002<br \/>\n\u56e0\u6b64\u8981\u5148\u7522\u751f\u8207\u4e0a\u50b3ssh key\u5230github\uff0c\u65b9\u4fbf\u4e4b\u5f8c\u8207\u4f3a\u670d\u5668\u4e4b\u9593\u7684\u901a\u8a0a\u3002<\/p>\n<p>Mac OS X \u8207 Linux\uff1a<\/p>\n<p>\u53ea\u8981\u8f38\u5165ssh-keygen -t rsa\u4e26\u7167\u8457\u6307\u793a\u5373\u53ef<\/p>\n<p>[~\/.ssh]$ ssh-keygen -t rsa<br \/>\nGenerating public\/private rsa key pair.<br \/>\nEnter file in which to save the key (\/home\/tom\/.ssh\/id_rsa):<br \/>\nEnter passphrase (empty for no passphrase): &lt;\u8f38\u5165\u5b58\u53d6\u6b64key\u4e4b\u5bc6\u78bc\uff0c\u6216\u76f4\u63a5\u6309\u4e0benter\u4f7f\u7528\u7a7a\u5bc6\u78bc&gt;<br \/>\nEnter same passphrase again: &lt;\u518d\u4e00\u6b21\u8f38\u5165\u76f8\u540c\u5bc6\u78bc&gt;<br \/>\nYour identification has been saved in \/home\/tom\/.ssh\/id_rsa.<br \/>\nYour public key has been saved in \/home\/tom\/.ssh\/id_rsa.pub.<br \/>\nThe key fingerprint is:<br \/>\n50:43:77:c6:97:af:61:82:dc:ea:9b:6b:67:d4:1b:61 tom@volcano<\/p>\n<p>\u60a8\u7684public key\u5c31\u5b58\u653e\u5728id_rsa.pub\u88e1\u9762\uff0c\u800cid_rsa\u5247\u662fprivate key\uff0c\u8acb\u59a5\u5584\u4fdd\u5b58\u4ee5\u514d\u907a\u5931\u3002<br \/>\n\u9019\u500bkey\u662f\u4e00\u5c0d\u7684\uff0cprivate key\u8981\u5b58\u653e\u65bc\u5bb6\u76ee\u9304\u4e0b\u7684.ssh\u8cc7\u6599\u593e\u4e2d\u3002public key\u5247\u8907\u88fd\u5f8c\uff0c\u8cbc\u4e0a\u60a8github\u5e33\u865f\u4e2d\u7684SSH Public Keys\u6b04\u4f4d\u3002\u6ce8\u610f\u5c0f\u5fc3\u4e0d\u8981\u8907\u88fd\u5230\u7a7a\u683c\u3002<\/p>\n<p>Windows:<\/p>\n<p>\u5728\u5b89\u88dd\u597d\u7684git\u9078\u55ae\u4e2d\u9078\u53d6git-bash\uff0c\u4e26\u8f38\u5165<\/p>\n<p>ssh-keygen -C \u201cusername@email.com\u201d -t rsa<\/p>\n<p>\u4e00\u6a23\u7167\u8457\u4e0a\u9762\u7684\u6307\u793a\uff0c\u8f38\u5165\u5bc6\u78bc\u6216\u8df3\u904e\u5bc6\u78bc\u8a2d\u5b9a\u4e4b\u3002key file\u4e00\u6a23\u653e\u5728\u5bb6\u76ee\u9304\u4e2d\u7684.ssh\u8cc7\u6599\u593e\u3002<\/p>\n<p>\u5c07Public key\u6240\u6709\u5167\u5bb9\u8907\u88fd\u5f8c\u8cbc\u4e0a\u60a8github\u5e33\u6236\u5e95\u4e0b\u7684 SSH Public Keys \u6b04\u4f4d\uff0c\u4e00\u6b21\u8cbc\u4e0a\u4e00\u500b(\u6ce8\u610f\uff0c\u9019\u908a\u8cbc\u4e0a\u7684\u662fpublic key\uff0c\u53e6\u5916\u8acb\u6ce8\u610f\u4e0d\u8981\u6709\u7a7a\u683c\u3002)<\/p>\n<p>3.\u8a2d\u5b9agithub\u5e33\u865f\u4e26\u958b\u555f\u4e00\u500brepo<\/p>\n<p>\u5728github\u60a8\u7684\u5e33\u865f\u53f3\u4e0a\u89d2\u53ef\u4ee5\u770b\u5230\u4e00\u500bYour Repositories\uff0c\u9ede\u9078Create one\u3002<br \/>\n\u8f38\u5165Project name\u4ee5\u5f8c\uff0c\u53ef\u4ee5\u770b\u5230\u4ed6\u6709\u6559\u5b78\u5982\u4f55\u6253\u958b\u4e00\u500b\u65b0\u7684\u5c08\u6848<\/p>\n<p>\u9019\u908a\u4ee5\u4e00\u500b\u540d\u70batest\u7684\u5c08\u6848\u70ba\u4f8b<\/p>\n<p>Global setup:<\/p>\n<p>Download and install Git<br \/>\ngit config &#8211;global user.email &lt;\u9019\u908a\u8f38\u5165\u60a8\u7684email&gt; #\u5148\u5728git\u81ea\u5df1\u7684\u5ee3\u57df\u8a2d\u5b9a\u4e2d\u8a2d\u597d\u60a8\u7684e-mail<\/p>\n<p>Next steps:<\/p>\n<p>mkdir test<br \/>\ncd test<br \/>\ngit init #\u7522\u751f.git\u8cc7\u6599\u593e\u4e26\u5b58\u653egit\u76f8\u95dc\u8cc7\u6599\u9032\u53bb\u3002<br \/>\ntouch README #\u52a0\u9ede\u4ec0\u9ebc\u6771\u897f\uff0c\u56e0\u70bagithub\u6703\u81ea\u52d5\u8b80\u5165\u60a8\u7684README\u6a94\u6848\u4e26\u986f\u793a\u65bc\u4e0b\u9762\uff0c\u56e0\u6b64\u5148\u7522\u751fREADME\u3002<br \/>\ngit add README #\u5c07README\u52a0\u5230stage<br \/>\ngit commit -m &#8216;first commit&#8217; #\u5728local repo(\u4e5f\u5c31\u662f\u60a8\u7684\u96fb\u8166\u4e0a)\u63d0\u4ea4\u70ba\u7b2c\u4e00\u500bcommmit\uff0c\u8a3b\u89e3\u70ba&#8217;first commit&#8217;\u3002\u9019\u500bcommit\u4e5f\u53ef\u8f38\u5165\u70baunicode\u4e2d\u6587\u3002big5\u4e0d\u77e5\u9053\u652f\u4e0d\u652f\u63f4\uff0c\u76ee\u524d\u770b\u8d77\u4f86\u61c9\u8a72\u4e0d\u884c\u3002<br \/>\ngit remote add origin git@github.com:&lt;\u60a8\u7684ID&gt;\/test.git #\u628agithub\u7684repo\u52a0\u5165\u70ba\u9060\u7aef\u7684repo<br \/>\ngit push origin master #\u628a\u76ee\u524d\u7684commit\u72c0\u614bpush\u4e26\u540c\u6b65\u5230github\u4e0a\u9762\u3002<\/p>\n<p>Existing Git Repo?<\/p>\n<p>cd existing_git_repo<br \/>\ngit remote add origin git@github.com:&lt;\u60a8\u7684ID&gt;\/test.git<br \/>\ngit push origin master<\/p>\n<p>\u628a\u60a8\u7684\u7a0b\u5f0f\u78bcpush\u4e0agithub\u5f8c\uff0c\u60a8\u5c31\u53ef\u4ee5\u6709\u81ea\u5df1\u7684repo\u4e86\u3002<\/p>\n<p>\u82e5\u60a8\u559c\u6b61\u5225\u4eba\u7684repo\uff0c\u53ea\u8981\u4ed6\u662fpublic\u7684\uff0c\u60a8\u5c31\u53ef\u4ee5\u9ede\u9078\u4e0a\u9762\u7684fork\uff0c\u628a\u6574\u500brepo\u8907\u88fd\u5230\u60a8\u7684\u5e33\u6236\u5e95\u4e0b\uff0c\u4e26\u958b\u59cb\u770b\u539f\u59cb\u78bc\uff0c\u5c0d\u4ed6\u4fee\u6539\u3002<\/p>\n<p>\u82e5\u60a8fork\u4e86\u4e00\u500brepo(\u5047\u8a2d\u540d\u7a31\u70batest)\u5230github\u4e2d\u4e4b\u5f8c\uff0c\u53ea\u8981\u8f38\u5165<\/p>\n<p>git clone git@github.com:&lt;\u60a8\u7684ID&gt;\/test.git test<\/p>\n<p>\u5c31\u53ef\u4ee5\u5c07\u6574\u500brepo\u8907\u88fd\u4e0b\u4f86\u4e26\u5b58\u653e\u5728test\u8cc7\u6599\u593e\u4e2d\u3002<\/p>\n<p>\u82e5\u60a8\u7684ssh key\u6709\u52a0\u4e0a\u5bc6\u78bc\u4fdd\u8b77\uff0c\u6bcf\u6b21\u8207github\u9023\u7dda\u7684\u904e\u7a0b\u4e2d\u90fd\u9700\u8981\u8f38\u5165\u5bc6\u78bc\u4ee5\u5b58\u53d6ssh key\u3002<\/p>\n<p>\u63a5\u4e0b\u4f86\u7c21\u55ae\u63cf\u8ff0\u4e00\u4e0bgit\u8981\u5982\u4f55\u4f7f\u7528\u3002<\/p>\n<p>\u9996\u5148\uff0c\u958b\u555f\u4e00\u500b\u5c08\u6848\u53ea\u8981\u8f38\u5165<\/p>\n<p>git init<\/p>\n<p>\u518d\u4f86\uff0c\u6bcf\u6b21\u4fee\u6539\u597d\u4e86\u4ee5\u5f8c\uff0c\u53ef\u4ee5\u5148\u5c07\u4fee\u6539\u5b58\u5165stage<\/p>\n<p>git add<\/p>\n<p>\u82e5\u4e00\u6b21\u4fee\u6539\u5927\u91cf\u6a94\u6848\uff0c\u53ef\u4ee5\u5c07\u6240\u6709\u6a94\u6848\u4fee\u6539\u90fdadd\u9032\u53bbstage<\/p>\n<p>git add .<\/p>\n<p>\u4e4b\u5f8ccommit\u63d0\u4ea4\u4e00\u6b21\u7684\u4fee\u6539<\/p>\n<p>git commit -m &#8220;\u8a3b\u89e3&#8221;<\/p>\n<p>\u53e6\u5916\u4e5f\u53ef\u4ee5\u628agit add\u8207git commit\u7528\u4e00\u500b\u6307\u4ee4\u5b8c\u6210<\/p>\n<p>git commit -a -m &#8220;\u8a3b\u89e3&#8221;<\/p>\n<p>git\u7279\u5225\u7684\u4e00\u9ede\u662f\uff0c\u4ed6\u53ef\u4ee5\u5728\u672c\u5730\u7aef\u958b\u555f\u4e26\u4f7f\u7528\u3002\u4e0a\u9762\u9019\u4e9b\u7528\u6cd5\u5b8c\u5168\u4e0d\u7528\u4f3a\u670d\u5668\uff0c\u672c\u6a5f\u5c31\u53ef\u4ee5\u57f7\u884c\u3002<\/p>\n<p>\u672c\u5730\u7aef\u6703\u6709\u81ea\u5df1\u7684repo\uff0c\u53ef\u4ee5\u5728\u98db\u6a5f\u4e0a\uff0c\u5404\u7a2e\u6c92\u6709\u7db2\u8def\u7684\u5730\u65b9\u90fd\u53ef\u4ee5\u9806\u5229\u4f7f\u7528\u4e26\u63d0\u4ea4\u4efb\u4f55\u8b8a\u66f4\u3002<\/p>\n<p>\u7b49\u60a8\u89ba\u5f97\u4fee\u6539\u597d\u4e86\uff0c\u53ef\u4ee5\u653e\u4e0a\u4f3a\u670d\u5668\u7684\u6642\u5019\uff0c\u78ba\u4fdd\u7db2\u8def\u9023\u7dda\u4e26\u8f38\u5165<\/p>\n<p>git push<\/p>\n<p>\u5c31\u53ef\u4ee5\u5c07\u9019\u908a\u7684\u6a94\u6848\u8207\u8b8a\u66f4\u63d0\u4ea4\u5230github\u4e0a\u9762\u3002<br \/>\n\u5982\u679c\u60a8\u5728github\u4e0a\u7684\u7248\u672c\u8f03\u65b0\uff0c\u4e5f\u53ef\u4ee5\u8f38\u5165<\/p>\n<p>git pull<\/p>\n<p>\u66f4\u65b0\u672c\u5730\u7aef\u7684repo\u3002<\/p>\n<p>\u5982\u679c\u4eca\u5929tom\u7684test repo\u6709\u4e86\u65b0\u7684\u8b8a\u66f4\uff0c\u544a\u8a34billy\uff0cbilly\u8981\u5c07\u8b8a\u66f4merge\u5230\u81ea\u5df1\u7684repo\u4e2d\uff0c\u53ef\u4ee5\u5728\u672c\u5730\u7aef\u8f38\u5165<\/p>\n<p>git pull git:\/\/github.com\/tom\/test.git<\/p>\n<p>pull\u9019\u500b\u6307\u4ee4\u5176\u5be6\u6db5\u84cb\u4e86fetch(\u5c07\u8b8a\u66f4\u8907\u88fd\u56de\u4f86)\u4ee5\u53camerge\u3002<br \/>\n\u56e0\u6b64\u7d93\u904emerge\u5f8c\uff0ctom\u7684\u8b8a\u66f4\u5c31\u52a0\u5165\u5230billy\u7684repo\u56c9\uff01<\/p>\n<p>\u53e6\u5916\u7248\u672c\u63a7\u5236\u7cfb\u7d71\u7684branch\u529f\u80fd\u4e5f\u5f88\u6709\u610f\u601d\uff0c\u82e5\u60a8\u7684\u7a0b\u5f0f\u78bc\u540c\u6642\u8981\u4fee\u6539bug\uff0c\u53c8\u8981\u52a0\u5165\u65b0\u529f\u80fd\uff0c\u53ef\u4ee5fork\u51fa\u4e00\u500bbranch\uff0c\u4e00\u500b\u5c08\u9580\u4feebug\uff0c\u4e00\u500b\u5c08\u9580\u52a0\u5165\u65b0\u529f\u80fd\uff0c\u7b49\u5230\u7a69\u5b9a\u5f8c\u518d\u4f86merge<\/p>\n<p>git branch bug_fix #\u5efa\u7acbbranch\uff0c\u540d\u70babug_fix<br \/>\ngit checkout bug_fix #\u5207\u63db\u5230bug_fix\u9019\u500bbranch<br \/>\ngit checkout master #\u63db\u70ba\u4e3b\u8981\u7684repo<br \/>\ngit merge bug_fix #\u628abug_fix\u9019\u500bbranch\u548c\u73fe\u5728\u7684branch\u5408\u4f75<br \/>\ngit push origin bug_fix:refs\/heads\/bug_fix #\u628abug_fix\u9019\u500bbranch\u63a8\u81f3\u9060\u7aefrepo\u4e0a\u9762<\/p>\n<p>\u82e5\u6709branch\u5728remote\uff0c\u60f3\u8981\u67e5\u770b\u4e26checkout\u51fa\u4f86<\/p>\n<p>git branch -r #\u67e5\u770b\u9060\u7aefbranch<br \/>\ngit checkout -b bug_fix_local bug_fix_remote #\u628a\u672c\u6a5f\u7aef\u5207\u63db\u70ba\u9060\u7aef\u7684bug_fix_remote branch\uff0c\u4e26\u547d\u540d\u70babug_fix_local<\/p>\n<p>\u9084\u6709\u5176\u4ed6\u53ef\u4ee5\u89c0\u770brepo\u72c0\u614b\u7684\u5de5\u5177<\/p>\n<p>git log #\u53ef\u4ee5\u67e5\u770b\u6bcf\u6b21commit\u7684\u6539\u8b8a<br \/>\ngit diff #\u53ef\u4ee5\u67e5\u770b\u6700\u8fd1\u4e00\u6b21\u6539\u8b8a\u7684\u5167\u5bb9\uff0c\u52a0\u4e0a\u53c3\u6578\u53ef\u4ee5\u770b\u5176\u4ed6\u7684\u6539\u8b8a\uff0c\u4e26\u4e92\u76f8\u6bd4\u8f03<br \/>\ngit show #\u53ef\u4ee5\u770b\u67d0\u6b21\u7684\u8b8a\u66f4<\/p>\n<p>\u82e5\u60f3\u77e5\u9053\u76ee\u524drepo\u7684\u72c0\u614b\uff0c\u53ef\u4ee5\u8f38\u5165<\/p>\n<p>git status<\/p>\n<p>\u9019\u908a\u53ea\u662f\u4e00\u4e9b\u7c21\u55ae\u7684\u529f\u80fd\uff0c\u9084\u6709\u66f4\u591a\u7684\u529f\u80fd\uff0c\u7b49\u5927\u5bb6\u53bb\u6478<br \/>\n\u60f3\u8981\u6df1\u5165\u4e86\u89e3git\uff0c\u53ef\u4ee5\u770b<br \/>\nhttpss:\/\/excess.org\/article\/2008\/07\/ogre-git-tutorial\/<br \/>\n\u9019\u500b\u6559\u5b78\u5f71\u7247\u8aaa\u660e\u7684\u5f88\u8a73\u7d30\u3002<\/p>\n<p>\u4e5f\u6709\u5f88\u591a\u5c0f\u5de5\u5177\uff0c\u6bd4\u5982\u9019\u500b<br \/>\nhttpss:\/\/gugod.org\/2008\/11\/github-badge.html<br \/>\n\u53ef\u4ee5\u628a\u60a8\u76ee\u524d\u7684github repos\u986f\u793a\u5728blog\u4e0a\u9762<\/p>\n<p>\u5e0c\u671b\u5927\u5bb6\u4e5f\u80fd\u5728git\u4e0a\u9762\u4f7f\u7528github\u958b\u5fc3\u7684\u958b\u767c\uff01<\/p>\n<p>\u53c3\u8003\u8cc7\u6599<br \/>\nhttpss:\/\/github.com\/guides\/home<br \/>\nhttpss:\/\/kylecordes.com\/2008\/04\/30\/git-windows-go\/<br \/>\nhttpss:\/\/nathanj.github.com\/gitguide\/creating.html<br \/>\nhttpss:\/\/www.qweruiop.org\/nchcrails\/posts\/49<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e2d\u6587\u4f7f\u7528\u4ecb\u7d39\uff1a Github httpss:\/\/sls.weco.net\/blog\/porsche780209 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[58,59],"class_list":["post-585","post","type-post","status-publish","format-standard","hentry","category-57","tag-git","tag-github"],"_links":{"self":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/585"}],"collection":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=585"}],"version-history":[{"count":11,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions"}],"predecessor-version":[{"id":685,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions\/685"}],"wp:attachment":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}