{"id":749,"date":"2017-06-05T09:32:21","date_gmt":"2017-06-05T01:32:21","guid":{"rendered":"http:\/\/www.rain1024.com\/?p=749"},"modified":"2023-08-07T20:57:27","modified_gmt":"2023-08-07T12:57:27","slug":"article-git83","status":"publish","type":"post","link":"http:\/\/rain1024.com\/index.php\/2017\/06\/05\/article-git83\/","title":{"rendered":"\u5173\u4e8eGit\u4ee5\u53ca\u51e0\u79cd\u8fdc\u7a0b\u5e93\u7684\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5173\u4e8eGit\u4ee5\u53ca\u51e0\u79cd\u8fdc\u7a0b\u5e93\u7684\u4ecb\u7ecd<\/p>\n<h2>\u7f51\u4e0a\u5173\u4e8eGit\u7684\u4ecb\u7ecd\u548c\u6559\u7a0b\u6709\u5f88\u591a\uff0c\u6211\u53ea\u662f\u4f1a\u57fa\u672c\u7684\u4f7f\u7528\uff0c\u4f46\u5bf9Git\u8fd9\u4e2a\u529f\u80fd\u5f88\u611f\u5174\u8da3\uff0c\u7ecf\u8fc7\u4e24\u5929\u7684\u7814\u7a76\uff0c\u628a\u6211\u4f7f\u7528\u7684\u4e00\u4e9b\u57fa\u672c\u64cd\u4f5c\u548c\u4f1a\u4f7f\u7528\u7684\u51e0\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u5199\u51fa\u6765\uff0c\u4ee5\u4f9b\u53c2\u8003\u3002<\/h2>\n<h2>Git\u4ecb\u7ecd<\/h2>\n<h3>\u6211\u5bf9Git\u7684\u7406\u89e3\u662f\u53ef\u4ee5\u4e0d\u65ad\u4fdd\u5b58\u5f00\u53d1\u8fdb\u5ea6\u7684\u4e00\u4e2a\u63a7\u5236\u8f6f\u4ef6\uff0c\u53ea\u8981\u8fd9\u4e2a\u6587\u4ef6\u5939\u8bbe\u7f6e\u4e3agit\u4ed3\u5e93\uff0c\u6211\u4ee5\u540e\u5bf9\u4ee3\u7801\u505a\u51fa\u7684\u4efb\u4f55\u66f4\u6539\uff0c\u90fd\u662f\u53ef\u4ee5\u8ffd\u67e5\uff0c\u64a4\u9500\u7684\uff0c\u4e0d\u6015\u53d1\u751f\u4ec0\u4e48\u4e0d\u53ef\u9006\u8f6c\u7684\u9519\u8bef\u3002<\/h3>\n<h3>\u5177\u4f53\u7684\u6559\u7a0b\u53ef\u4ee5\u53c2\u8003<a href=\"http:\/\/www.runoob.com\/git\/git-tutorial.html\">\u83dc\u9e1f\u6559\u7a0b<\/a>\uff0c\u548c<a href=\"http:\/\/www.liaoxuefeng.com\/wiki\/0013739516305929606dd18361248578c67b8067c8c017b000\">\u5ed6\u96ea\u5cf0git\u6559\u7a0b<\/a>\uff0c\u8fd9\u91cc\u6211\u53ea\u5217\u4e3e\u51fa\u6211\u5e38\u4f7f\u7528\u7684\u547d\u4ee4\u8bed\u53e5<\/h3>\n<ul>\n<li>git init (\u65b0\u5efa\u4ed3\u5e93)<\/li>\n<li>git add (\u6dfb\u52a0\u8981\u653e\u5230\u5de5\u4f5c\u533a\u7684\u6587\u4ef6\uff0c\u5982\u679c\u662f.\uff0c\u5219\u8868\u793a\u6240\u6709\u6587\u4ef6)<\/li>\n<li>git status (\u663e\u793a\u5f53\u524d\u6587\u4ef6\u7684\u72b6\u6001\uff0c\u662f\u5426\u63d0\u4ea4\uff0c\u6216\u8005\u662f\u5426\u5728\u5de5\u4f5c\u533a\uff0c-s\u663e\u793a\u7b80\u7565\u4fe1\u606f)<\/li>\n<li>git commit -m \"\" (\u5c06\u5de5\u4f5c\u533a\u7684\u6587\u4ef6\u4fdd\u5b58\u5230\u4ed3\u50a8\uff0c\u53cc\u5f15\u53f7\u91cc\u662f\u8fd9\u6b21\u66f4\u6539\u7684\u8bf4\u660e\uff0c\u5fc5\u5199)<\/li>\n<li>git clone [url] (\u4f7f\u7528 git clone \u62f7\u8d1d\u4e00\u4e2a Git \u4ed3\u5e93\u5230\u672c\u5730\uff0c\u8ba9\u81ea\u5df1\u80fd\u591f\u67e5\u770b\u8be5\u9879\u76ee\uff0c\u6216\u8005\u8fdb\u884c\u4fee\u6539\u3002)<\/li>\n<li>git diff   (\u6267\u884c git diff \u6765\u67e5\u770b\u6267\u884c git status \u7684\u7ed3\u679c\u7684\u8be6\u7ec6\u4fe1\u606f\u3002)<\/li>\n<li>\n<ul>\n<li>git diff \u547d\u4ee4\u663e\u793a\u5df2\u5199\u5165\u7f13\u5b58\u4e0e\u5df2\u4fee\u6539\u4f46\u5c1a\u672a\u5199\u5165\u7f13\u5b58\u7684\u6539\u52a8\u7684\u533a\u522b\u3002git diff \u6709\u4e24\u4e2a\u4e3b\u8981\u7684\u5e94\u7528\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u5c1a\u672a\u7f13\u5b58\u7684\u6539\u52a8\uff1agit diff<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u67e5\u770b\u5df2\u7f13\u5b58\u7684\u6539\u52a8\uff1a git diff --cached<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u67e5\u770b\u5df2\u7f13\u5b58\u7684\u4e0e\u672a\u7f13\u5b58\u7684\u6240\u6709\u6539\u52a8\uff1agit diff HEAD<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u663e\u793a\u6458\u8981\u800c\u975e\u6574\u4e2a diff\uff1agit diff --stat<\/li>\n<\/ul>\n<\/li>\n<li>git rm (\u4f1a\u5c06\u6761\u76ee\u4ece\u7f13\u5b58\u533a\u4e2d\u79fb\u9664\u3002\u8fd9\u4e0e git reset HEAD \u5c06\u6761\u76ee\u53d6\u6d88\u7f13\u5b58\u662f\u6709\u533a\u522b\u7684\u3002 \"\u53d6\u6d88\u7f13\u5b58\"\u7684\u610f\u601d\u5c31\u662f\u5c06\u7f13\u5b58\u533a\u6062\u590d\u4e3a\u6211\u4eec\u505a\u51fa\u4fee\u6539\u4e4b\u524d\u7684\u6837\u5b50\u3002)<\/li>\n<li>git remote add origin git@server-name:path\/repo-name.git (\u5173\u8054\u4e00\u4e2a\u8fdc\u7a0b\u5e93)<\/li>\n<li>git push -u origin master (\u5173\u8054\u540e\uff0c\u7b2c\u4e00\u6b21\u63a8\u9001\u9700\u8981\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4)<\/li>\n<li>git push origin master (\u5411\u8fdc\u7a0b\u5e93\u63a8\u9001)<\/li>\n<li>git pull --rebase origin master (\u5982\u679c\u7b2c\u4e00\u6b21\u63a8\u9001\u65f6\u8fdc\u7a0b\u5e93\u5185\u5bb9\u4e0d\u4e3a\u7a7a\uff0c\u5219\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fdc\u7a0b\u5e93\u7684\u5185\u5bb9\u540c\u6b65\u5230\u672c\u5730\uff0c\u4e5f\u53ef\u4ee5\u5728push\u540e\u52a0-f\uff0c\u5f3a\u5236\u63a8\u9001)<\/li>\n<\/ul>\n<h2>\u8fdc\u7a0b\u5e93\u4ecb\u7ecd<\/h2>\n<h3>\u5173\u4e8e\u8fdc\u7a0b\u5e93\uff0c\u4f7f\u7528\u7684\u6700\u591a\u7684\u5e94\u8be5\u5c31\u662fGitHub\u4e86\uff0c\u4f46GitHub\u53ea\u6709\u516c\u6709\u4ed3\u5e93\uff0c\u800c\u4e14\u8bbf\u95ee\u6709\u4e9b\u6162\uff0c\u4ee5\u53ca\u7f51\u7ad9\u5076\u5c14\u4f1a\u88ab\u5899\u4e86\uff0c\u6240\u4ee5\u6211\u4e00\u4e9b\u79c1\u6709\u7684\u4ee3\u7801\u5c31\u653e\u5230\u5176\u4ed6\u4e24\u4e2a\u4ed3\u5e93\u91cc\uff0c\u5206\u522b\u662f\u7801\u4e91\u548c\u963f\u91cc\u4ed3\u5e93\u3002<\/h3>\n<h3>\u7801\u4e91\u8fd8\u662f\u5f88\u6709\u540d\u7684\uff0c\u4e2d\u56fd\u7684\u5f00\u6e90\u793e\u533a\uff0c\u6bcf\u4e2a\u7528\u6237\u63d0\u4f9b1000\u4e2a\u9879\u76ee\uff0c\u6bcf\u4e2a\u9879\u76ee\u597d\u50cf\u662f\u6700\u59271G\uff0c\u5e94\u8be5\u8db3\u591f\u7528\u4e86\uff0c\u53c8\u4e0d\u662f\u5f53\u7f51\u76d8\u4f7f\u7528\uff0c\u9879\u76ee\u53ef\u4ee5\u81ea\u5b9a\u516c\u6709\u79c1\u6709\uff0c\u800c\u4e14\u7801\u4e91\u8fd8\u6709APP\u53ef\u4ee5\u4f7f\u7528\uff0c\u7801\u4e91\u9664\u4e86\u63d0\u4f9b\u6700\u57fa\u7840\u7684 Git \u4ee3\u7801\u6258\u7ba1\u4e4b\u5916\uff0c\u8fd8\u63d0\u4f9b\u4ee3\u7801\u5728\u7ebf\u67e5\u770b\u3001\u5386\u53f2\u7248\u672c\u67e5\u770b\u3001Fork\u3001Pull Request\u3001\u6253\u5305\u4e0b\u8f7d\u4efb\u610f\u7248\u672c\u3001Issue\u3001Wiki \u3001\u4fdd\u62a4\u5206\u652f\u3001\u4ee3\u7801\u8d28\u91cf\u68c0\u6d4b\u3001PaaS \u9879\u76ee\u6f14\u793a\u7b49\u65b9\u4fbf\u7ba1\u7406\u3001\u5f00\u53d1\u3001\u534f\u4f5c\u3001\u5171\u4eab\u7684\u529f\u80fd\u3002<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git2.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git3.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git1.jpg\" alt=\"\" \/><\/p>\n<h3>\u963f\u91cc\u4ed3\u5e93\uff0c\u662f\u6211\u5728\u4e70\u4e91\u4e3b\u673a\u662f\u770b\u5230\u7684\uff0c\u6bcf\u4eba\u5e94\u8be5\u662f\u670950G\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c\u4f7f\u7528\u8d77\u6765\u8fd8\u53ef\u4ee5\uff0c\u4f46\u662f\u6709\u4e9b\u6162\uff0c\u5f88\u8bbf\u95ee\u963f\u91cc\u4e91\u7684\u63a7\u5236\u53f0\u4e00\u6837\u6162\uff0c\u800c\u4e14\u91cc\u9762\u7684\u754c\u9762\u5168\u662f\u82f1\u6587\uff0c\u6211\u5f88\u5947\u602a\uff0c\u518d\u5176\u4ed6\u7684\u548cGitHub\u4e00\u6837\uff0c\u6211\u53ea\u662f\u62ff\u5b83\u4f5c\u4e3a\u5b58\u50a8\u6587\u4ef6\u7684\u5e93\uff0c\u4ee3\u7801\u5e93\u8fd8\u662f\u7528\u7801\u4e91\u6bd4\u8f83\u597d\u3002<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git4.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git5.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog-1252406596.costj.myqcloud.com\/blog\/git6.jpg\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8eGit\u4ee5\u53ca\u51e0\u79cd\u8fdc\u7a0b\u5e93\u7684\u4ecb\u7ecd \u7f51\u4e0a\u5173\u4e8eGit\u7684\u4ecb\u7ecd\u548c\u6559\u7a0b\u6709\u5f88\u591a\uff0c\u6211\u53ea\u662f\u4f1a\u57fa\u672c\u7684\u4f7f\u7528\uff0c\u4f46\u5bf9Git\u8fd9\u4e2a\u529f\u80fd\u5f88\u611f\u5174\u2026 <span class=\"read-more\"><a href=\"http:\/\/rain1024.com\/index.php\/2017\/06\/05\/article-git83\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":751,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[74],"class_list":["post-749","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technique","tag-know"],"_links":{"self":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/comments?post=749"}],"version-history":[{"count":1,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/749\/revisions"}],"predecessor-version":[{"id":1450,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/749\/revisions\/1450"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media\/751"}],"wp:attachment":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media?parent=749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/categories?post=749"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/tags?post=749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}