{"id":934,"date":"2022-03-17T15:03:46","date_gmt":"2022-03-17T07:03:46","guid":{"rendered":"http:\/\/zhuxinyong.com\/?p=934"},"modified":"2022-03-25T15:54:36","modified_gmt":"2022-03-25T07:54:36","slug":"git-bi-hui-ming-lingaddcommit","status":"publish","type":"post","link":"https:\/\/zhuxinyong.com\/?p=934","title":{"rendered":"Git\u5fc5\u4f1a\u547d\u4ee4-add&#038;commit"},"content":{"rendered":"<p>\u5728\u6211\u4eec\u521d\u59cb\u5316\u597d\u9879\u76ee\u6216\u514b\u9686\u4e00\u4e2a\u9879\u76ee\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u9700\u8981\u5f00\u59cb\u5de5\u4f5c\u3002\u4fee\u6539\u6587\u4ef6\uff0c\u63d0\u4ea4\u6587\u4ef6\uff0c\u5faa\u73af\u5f80\u590d\u3002<br \/>\n\u6b64\u65f6\u6211\u5728\u6587\u4ef6 app.js \u4e2d\u65b0\u589e\u4e86\u4e00\u4e9b\u4e1c\u897f\u4ee5\u53ca\u65b0\u589e\u4e86\u4e00\u4e2a other.js \u6587\u4ef6:<\/p>\n<pre><code class=\"language-plain_text\">console.log('edit sth')\n<\/code><\/pre>\n<p>\u901a\u5e38\u6211\u4eec\u4f1a\u68c0\u67e5\u4e00\u4e0b\u73b0\u5728\uff0c\u5bf9\u5f53\u524d\u9879\u76ee\u505a\u4e86\u54ea\u4e9b\u4fee\u6539\uff0c\u7279\u522b\u662f\u5728\u9879\u76ee\u5e9e\u5927\u4ee5\u53ca\u4fee\u6539\u7684\u6587\u4ef6\u591a\u4e86\u4ee5\u540e\uff0c\u518d\u63d0\u4ea4\u4e4b\u524d\u8fdb\u884c\u67e5\u770b\u662f\u5f88\u6709\u5fc5\u8981\u7684\uff1a<\/p>\n<pre><code class=\"language-plain_text\">git status\n<\/code><\/pre>\n<p>\u5982\u4e0a\u547d\u4ee4\u53ef\u4ee5\u6e05\u6670\u7684\u5217\u51fa\u5bf9\u9879\u76ee\u7684\u54ea\u4e9b\u6587\u4ef6\u505a\u4e86\u4fee\u6539\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/03\/16475007076203.jpg\" alt=\"\" \/><\/p>\n<p>\u786e\u8ba4\u4ee5\u4e0a\u6587\u4ef6\u786e\u5b9e\u9700\u8981\u63d0\u4ea4\uff0c\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-plain_text\">git add app.js other.js\n<\/code><\/pre>\n<p>\u5f53\u6587\u4ef6\u591a\u7684\u65f6\u5019\uff0c\u4e00\u4e2a\u4e2aadd \u4e5f\u5f88\u9ebb\u70e6\uff0c\u6240\u4ee5 git add . (\u540e\u9762\u6709\u4e00\u4e2a\u70b9\uff0c\u4e0b\u9762\u8fd8\u6709\u7c7b\u4f3c\u7684\u547d\u4ee4\uff0c\u533a\u522b\u89c1\u6700\u540e\u56fe\u7247)\u53ef\u4ee5\u628a\u6240\u6709\u7684\u6587\u4ef6\u52a0\u5165\u7d22\u5f15\uff0c\u4e4b\u540e\u518d git status \u4e00\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/03\/16475007883784.jpg\" alt=\"\" \/><\/p>\n<p>\u6587\u4ef6\u53d8\u6210\u7eff\u8272\u8bf4\u660e\u5df2\u7ecf\u51c6\u5907\u597d\u5907\u6ce8\u4fe1\u606f\uff0c\u5f53\u7136\u8fd9\u4e00\u6b65\u7684 git status \u4e0d\u662f\u5fc5\u987b\u7684\u3002\u4e4b\u540e git commit \u5907\u6ce8\u4e00\u4e9b\u8fd9\u6b21\u4fee\u6539\u7684\u5185\u5bb9\uff1a<\/p>\n<pre><code class=\"language-plain_text\">git commit -m &quot;edit app.js &amp; add other.js file&quot;\n<\/code><\/pre>\n<p>git status \uff08\u975e\u5fc5\u987b\uff0c\u53ea\u662f\u4e3a\u4e86\u6f14\u793a\u6bcf\u6b21\u64cd\u4f5c\u4e4b\u540e\u7684\u6837\u5b50\uff09\u518d\u770b\u4e00\u4e0b\uff1a<\/p>\n<p>git add \u548c git commit \u8fd9\u4e24\u4e2a\u547d\u4ee4\u5f0f Git \u5de5\u4f5c\u6d41\u7684\u6700\u57fa\u7840\u547d\u4ee4\u3002\u6bcf\u4e2aGit \u7528\u6237\u90fd\u9700\u8981\u4e86\u89e3\u548c\u56e2\u961f\u7684 Git \u5de5\u4f5c\u6d41\u65e0\u5173\u3002<\/p>\n<p>\u6211\u4e60\u60ef\u628a add \u4e0e commit \u6bd4\u55bb\u6210\u4ed3\u5e93\u53d1\u8d27\uff1a<\/p>\n<ol>\n<li>\u53d1\u8d27\u5458\u628a\u8d27\u52a0\u5165\uff08git add \uff09\u8d27\u8f66\u3002<\/li>\n<li>\u7ba1\u7406\u4eba\u5458\u76d6\u7ae0\uff08git commit\uff09\u786e\u8ba4\u65e0\u8bef\u51c6\u5907\u53d1\u8d27\u3002<\/li>\n<\/ol>\n<p>\u53e6\uff1a<br \/>\ngit add . vs git add -A vs git add -u\u7b49\u7684\u533a\u522b \u5177\u4f53\u53c2\u8003\uff1a<\/p>\n<p><a href=\"https:\/\/git-scm.com\/docs\/git-add\" target=\"_blank\" rel=\"noopener\">https:\/\/git-scm.com\/docs\/git-add<\/a><\/p>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/572549\/difference-between-git-add-a-and-git-add\" target=\"_blank\" rel=\"noopener\">https:\/\/stackoverflow.com\/questions\/572549\/difference-between-git-add-a-and-git-add<\/a><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/03\/16475008638433.jpg\" alt=\"\" \/><\/p>\n<p>\u8fd8\u6709 git add . \uff08\u5047\u8bbe\u6ca1\u6709\u5728\u9879\u76ee\u6839\u76ee\u5f55\u6267\u884c\u8be5\u547d\u4ee4\uff09\u53ea\u80fd\u628a\u5f53\u524d\u76ee\u5f55\u548c\u5b50\u76ee\u5f55\u7684\u6587\u4ef6\u52a0\u5165\u7d22\u5f15\uff0c\u4e0d\u80fd\u64cd\u4f5c\u7236\u7ea7\u76ee\u5f55\uff0c\u800c git add -A \u53ef\u4ee5\u628a\u5f53\u524d\u9879\u76ee\u7684\u6240\u6709\u66f4\u6539\u6587\u4ef6\u52a0\u5165\u7d22\u5f15<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6211\u4eec\u521d\u59cb\u5316\u597d\u9879\u76ee\u6216\u514b\u9686\u4e00\u4e2a\u9879\u76ee\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u9700\u8981\u5f00\u59cb\u5de5\u4f5c\u3002\u4fee\u6539\u6587\u4ef6\uff0c\u63d0\u4ea4\u6587\u4ef6\uff0c\u5faa\u73af\u5f80\u590d\u3002 \u6b64\u65f6\u6211\u5728\u6587&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,27,3],"tags":[28],"class_list":["post-934","post","type-post","status-publish","format-standard","hentry","category-all","category-tool","category-tech","tag-git"],"_links":{"self":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=934"}],"version-history":[{"count":2,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/934\/revisions"}],"predecessor-version":[{"id":944,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/934\/revisions\/944"}],"wp:attachment":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}