﻿{"id":59,"date":"2018-03-07T10:19:40","date_gmt":"2018-03-07T02:19:40","guid":{"rendered":"http:\/\/www.cloudy.pub\/?p=59"},"modified":"2018-04-17T20:23:03","modified_gmt":"2018-04-17T12:23:03","slug":"git%e4%bd%bf%e7%94%a8%e8%aa%aa%e6%98%8e%ef%bc%88%e6%95%b4%e5%90%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.0moon.com\/?p=59","title":{"rendered":"git\u4f7f\u7528\u8aaa\u660e\uff08\u6574\u5408\uff09"},"content":{"rendered":"<p>\u5bfc\u5165\u672c\u4f53\u76ee\u5f55\u5230git\uff0c\u5373\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>1\u3001<code>git init<\/code> \/\/\u521d\u59cb\u5316\u9879\u76ee\uff0c\u6267\u884c\u5b8c\u6b64\u547d\u4ee4\u540e\u4f1a\u751f\u6210\u4e00\u4e2a.git\u6587\u4ef6\u5939<br \/>\n2\u3001<code>git add .<\/code> \/\/\u5c06\u672c\u5730\u9879\u76ee\u6240\u6709\u6587\u4ef6\u6dfb\u52a0\u5230git\u7ba1\u7406<br \/>\n3\u3001<code>git commit -m \"\u63d0\u4ea4\u63cf\u8ff0\" <\/code>\/\/\u672c\u5730\u63d0\u4ea4<br \/>\n4\u3001git remote add origin \u521a\u521a\u65b0\u5efa\u7684Github\u5730\u5740url \/\/\u5c06\u672c\u5730\u9879\u76ee\u4e0e\u8fdc\u7a0bgit\u4ed3\u5e93\u5173\u8054<br \/>\n5\u3001git push -u origin master \/\/\u8fdc\u7a0b\u63d0\u4ea4\uff1b\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff0c\u7528\u8fd9\u4e2a\u547d\u4ee4git push -f origin master\uff0c\u5f3a\u5236\u5c06\u672c\u5730\u9879\u76eepush\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/p>\n<p>\u4e0b\u8f7dcheckout\uff1a<\/p>\n<p>1\u3001<span class=\"pln\">git clone <\/span><span class=\"pun\">\/<\/span><span class=\"pln\">path<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">to<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">repository \u00a0 \u6216\u8005 \u00a0\u00a0<\/span><span class=\"pln\">git clone username@host<\/span><span class=\"pun\">:<\/span><span class=\"str\">\/path\/<\/span><span class=\"pln\">to<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">repository<\/span><\/p>\n<p>\u8eab\u4efd\u8bf4\u660e\uff1a<\/p>\n<pre class=\"prettyprint prettyprinted\"><span class=\"pln\">1\u3001git config <\/span><span class=\"pun\">--<\/span><span class=\"kwd\">global<\/span><span class=\"pln\"> user<\/span><span class=\"pun\">.<\/span><span class=\"pln\">name <\/span><span class=\"str\">\"your name\"<\/span><span class=\"pln\">\r\n2\u3001git config <\/span><span class=\"pun\">--<\/span><span class=\"kwd\">global<\/span><span class=\"pln\"> user<\/span><span class=\"pun\">.<\/span><span class=\"pln\">email <\/span><span class=\"str\">\"your_email@youremail.com\"<\/span><\/pre>\n<p>\u68c0\u67e5\u72b6\u6001\uff1a<\/p>\n<p>1\u3001git status<\/p>\n<p>&nbsp;<\/p>\n<p>\u6240\u6709\u547d\u4ee4\uff1a<\/p>\n<p>$ git &#8211;help<br \/>\nusage: git [&#8211;version] [&#8211;help] [-C &lt;path&gt;] [-c name=value]<br \/>\n[&#8211;exec-path[=&lt;path&gt;]] [&#8211;html-path] [&#8211;man-path] [&#8211;info-path]<br \/>\n[-p | &#8211;paginate | &#8211;no-pager] [&#8211;no-replace-objects] [&#8211;bare]<br \/>\n[&#8211;git-dir=&lt;path&gt;] [&#8211;work-tree=&lt;path&gt;] [&#8211;namespace=&lt;name&gt;]<br \/>\n&lt;command&gt; [&lt;args&gt;]<\/p>\n<p><em>start a working area (see also: git help tutorial)<\/em><br \/>\nclone <span style=\"color: #ff0000;\">&#8212;<\/span> Clone a repository into a new directory<br \/>\ninit <span style=\"color: #ff0000;\">&#8212;<\/span>\u00a0Create an empty Git repository or reinitialize an existing one<\/p>\n<p><em>work on the current change (see also: git help everyday)<\/em><br \/>\nadd <span style=\"color: #ff0000;\">&#8212;<\/span> Add file contents to the index<br \/>\nmv <span style=\"color: #ff0000;\">&#8212;<\/span> Move or rename a file, a directory, or a symlink<br \/>\nreset <span style=\"color: #ff0000;\">&#8212;<\/span> Reset current HEAD to the specified state<br \/>\nrm <span style=\"color: #ff0000;\">&#8212;<\/span> Remove files from the working tree and from the index<\/p>\n<p><em>examine the history and state (see also: git help revisions)<\/em><br \/>\nbisect <span style=\"color: #ff0000;\">&#8212;<\/span> Use binary search to find the commit that introduced a bug<br \/>\ngrep <span style=\"color: #ff0000;\">&#8212;<\/span> Print lines matching a pattern<br \/>\nlog <span style=\"color: #ff0000;\">&#8212;<\/span> Show commit logs<br \/>\nshow <span style=\"color: #ff0000;\">&#8212;<\/span> Show various types of objects<br \/>\nstatus <span style=\"color: #ff0000;\">&#8212;<\/span> Show the working tree status<\/p>\n<p><em>grow, mark and tweak your common history<\/em><br \/>\nbranch <span style=\"color: #ff0000;\">&#8212;<\/span> List, create, or delete branches<br \/>\ncheckout <span style=\"color: #ff0000;\">&#8212;<\/span> Switch branches or restore working tree files<br \/>\ncommit <span style=\"color: #ff0000;\">&#8212;<\/span> Record changes to the repository<br \/>\ndiff <span style=\"color: #ff0000;\">&#8212;<\/span> Show changes between commits, commit and working tree, etc<br \/>\nmerge <span style=\"color: #ff0000;\">&#8212;<\/span> Join two or more development histories together<br \/>\nrebase <span style=\"color: #ff0000;\">&#8212;<\/span> Reapply commits on top of another base tip<br \/>\ntag <span style=\"color: #ff0000;\">&#8212;<\/span> Create, list, delete or verify a tag object signed with GPG<\/p>\n<p><em>collaborate (see also: git help workflows)<\/em><br \/>\nfetch <span style=\"color: #ff0000;\">&#8212;<\/span> Download objects and refs from another repository<br \/>\npull <span style=\"color: #ff0000;\">&#8212;<\/span> Fetch from and integrate with another repository or a local branch<br \/>\npush <span style=\"color: #ff0000;\">&#8212;<\/span> Update remote refs along with associated objects<\/p>\n<p>&#8216;git help -a&#8217; and &#8216;git help -g&#8217; list available subcommands and some<br \/>\nconcept guides. See &#8216;git help &lt;command&gt;&#8217; or &#8216;git help &lt;concept&gt;&#8217;<br \/>\nto read about a specific subcommand or concept.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bfc\u5165\u672c\u4f53\u76ee\u5f55\u5230git\uff0c\u5373\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a 1\u3001git init \/\/\u521d\u59cb\u5316\u9879\u76ee\uff0c\u6267\u884c\u5b8c\u6b64\u547d\u4ee4\u540e\u4f1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-study"],"_links":{"self":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59"}],"version-history":[{"count":3,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions\/100"}],"wp:attachment":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}