{"id":37314,"date":"2023-04-18T12:43:23","date_gmt":"2023-12-27T08:03:50","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/"},"modified":"2024-04-30T00:06:29","modified_gmt":"2024-04-29T16:06:29","slug":"git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/","title":{"rendered":"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f"},"content":{"rendered":"<h1>\u7ed3\u8bba<\/h1>\n<p>git add -A \u548c git add . \u7684\u533a\u522b\u5982\u4e0b\uff1a<br \/>\ngit add -A \uff1a\u5c06\u6574\u4e2a\u6811\u76ee\u5f55\u4f5c\u4e3a\u76ee\u6807<br \/>\ngit add . \uff1a\u5c06\u5f53\u524d\u76ee\u5f55\u53ca\u5176\u5b50\u76ee\u5f55\u4f5c\u4e3a\u76ee\u6807<\/p>\n<p>Git 1.x \u7248\u672c\u5305\u542b\u4e86\u88ab\u5220\u9664\u7684\u6587\u4ef6\uff0c\u800c Git 2.0 \u7248\u672c\u5219\u6ca1\u6709\u8fd9\u4e2a\u533a\u522b\u3002<\/p>\n<h1>\u6838\u5b9e<\/h1>\n<p>\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5de5\u4f5c\u7528\u7684\u6587\u4ef6\u5939\uff0c\u5e76\u521d\u59cb\u5316git\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">mkdir <\/span>git-training\r\n<span class=\"nb\">cd <\/span>git-training\r\ngit init\r\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u9a8c\u8bc1\u4e0b\u4e00\u6b65\u64cd\u4f5c\uff0c\u6211\u4eec\u8981\u8fdb\u884c\u6587\u4ef6\u7684\u521b\u5efa\u548c\u7f16\u8f91\u3002\uff08\u6211\u4eec\u4f7f\u7528\u4e86git add -A\uff0c\u4f46\u662f\u73b0\u5728\u5148\u4e0d\u8981\u5728\u610f\uff0c\u8fd9\u53ea\u662f\u4e3a\u4e86\u51c6\u5907\u3002\uff09<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">echo<\/span> <span class=\"s1\">'Change me.'<\/span> <span class=\"o\">&gt;<\/span> change-me.txt\r\n<span class=\"nb\">echo<\/span> <span class=\"s1\">'Delete me.'<\/span> <span class=\"o\">&gt;<\/span> delete-me.txt\r\ngit add <span class=\"nt\">-A<\/span>\r\ngit commit <span class=\"nt\">-m<\/span> <span class=\"s1\">'\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0'<\/span>\r\n<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\u5c06\u8fdb\u884c\u5b9e\u9645\u7684\u6dfb\u52a0\u64cd\u4f5c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">echo<\/span> <span class=\"s1\">'New file.'<\/span> <span class=\"o\">&gt;<\/span> new-file.txt\r\n<span class=\"nb\">mkdir dir\r\nmkdir dir<\/span>\/subdir\r\n<span class=\"nb\">echo<\/span> <span class=\"s1\">'File in dir.'<\/span> <span class=\"o\">&gt;<\/span> <span class=\"nb\">dir<\/span>\/file.txt\r\n<span class=\"nb\">echo<\/span> <span class=\"s1\">'File in subdir.'<\/span> <span class=\"o\">&gt;<\/span> <span class=\"nb\">dir<\/span>\/subdir\/file.txt\r\n<span class=\"nb\">echo<\/span> <span class=\"s1\">' Changed.'<\/span> <span class=\"o\">&gt;&gt;<\/span> change-me.txt\r\n<span class=\"nb\">rm <\/span>delete-me.txt\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>git status\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>git add <span class=\"nt\">-A<\/span>\r\ngit reset\r\ngit add <span class=\"nb\">.<\/span>\r\ngit reset\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\u8fd9\u4e24\u4e2a\u662f\u6ca1\u6709\u533a\u522b\u7684\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd dir\r\n<\/span>git add <span class=\"nt\">-A<\/span>\r\ngit reset\r\ngit add <span class=\"nb\">.<\/span>\r\ngit reset\r\n<\/code><\/pre>\n<p>git add -A \u547d\u4ee4\u4f1a\u5c06\u6574\u4e2a\u6587\u4ef6\u6811\u90fd\u7eb3\u5165\u5230\u64cd\u4f5c\u5bf9\u8c61\u4e2d\uff0c\u800c git add . \u547d\u4ee4\u53ea\u4f1a\u5c06\u5f53\u524d\u76ee\u5f55\u53ca\u5176\u5b50\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u7eb3\u5165\u5230\u64cd\u4f5c\u5bf9\u8c61\u4e2d\u3002<\/p>\n<h1>\u8bf7\u63d0\u4f9b\u66f4\u591a\u4e0a\u4e0b\u6587\u6216\u8be6\u7ec6\u7684\u4fe1\u606f\u3002<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3068\u3046\u3068\u3046 Git 2.0 \u304c\u73fe\u5b9f\u306e\u3082\u306e\u306b\u3002\u4fbf\u5229\u306a\u6a5f\u80fd\u6e80\u8f09<\/ul>\n<\/li>\n<\/ul>\n<p>Difference between \u201cgit add -A\u201d and \u201cgit add .\u201d<\/p>\n<p>Charles \u3055\u3093\u304c \u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3064\u3044\u3066\u3001Developer\u3055\u3093\u304cGit2.0\u4ee5\u964d\u306e\u52d5\u4f5c\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u308b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed3\u8bba git add -A \u548c git add . \u7684\u533a\u522b\u5982\u4e0b\uff1a git add -A \uff1a\u5c06\u6574\u4e2a\u6811\u76ee\u5f55\u4f5c\u4e3a\u76ee\u6807 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37314","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x\u4e2d\uff0cgit-add-a\u548cgit-add-\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\" \/>\n<meta property=\"og:description\" content=\"\u7ed3\u8bba git add -A \u548c git add . \u7684\u533a\u522b\u5982\u4e0b\uff1a git add -A \uff1a\u5c06\u6574\u4e2a\u6811\u76ee\u5f55\u4f5c\u4e3a\u76ee\u6807 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x\u4e2d\uff0cgit-add-a\u548cgit-add-\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-27T08:03:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T16:06:29+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/\",\"name\":\"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-12-27T08:03:50+00:00\",\"dateModified\":\"2024-04-29T16:06:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x\u4e2d\uff0cgit-add-a\u548cgit-add-\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\/","og_locale":"zh_CN","og_type":"article","og_title":"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f","og_description":"\u7ed3\u8bba git add -A \u548c git add . \u7684\u533a\u522b\u5982\u4e0b\uff1a git add -A \uff1a\u5c06\u6574\u4e2a\u6811\u76ee\u5f55\u4f5c\u4e3a\u76ee\u6807 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x\u4e2d\uff0cgit-add-a\u548cgit-add-\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-12-27T08:03:50+00:00","article_modified_time":"2024-04-29T16:06:29+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/","name":"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-12-27T08:03:50+00:00","dateModified":"2024-04-29T16:06:29+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Git 2.x\u4e2d\uff0c\u201cgit add -A\u201d\u548c\u201cgit add .\u201d\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-2-x%e4%b8%ad%ef%bc%8cgit-add-a%e5%92%8cgit-add-%e4%b9%8b%e9%97%b4%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=37314"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37314\/revisions"}],"predecessor-version":[{"id":88469,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37314\/revisions\/88469"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}