{"id":37450,"date":"2022-09-29T05:10:18","date_gmt":"2023-08-11T09:32:12","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/"},"modified":"2024-01-15T09:28:37","modified_gmt":"2024-01-15T01:28:37","slug":"git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/","title":{"rendered":"Git \u547d\u4ee4\u603b\u7ed3"},"content":{"rendered":"<p>\u7531\u4e8e\u6211\u8bb0\u5f55\u4e86\u4f7f\u7528Git\u8fdb\u884c\u4e2a\u4eba\u4f7f\u7528\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u6211\u4e0e\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002<br \/>\n\u5982\u679c\u6709\u7528\u7684\u8bdd\uff0c\u8bf7\u968f\u610f\u4f7f\u7528\u3002<\/p>\n<p>:wq : \u4fdd\u5b58\u5e76\u9000\u51fa<br \/>\n:q! : \u4e0d\u4fdd\u5b58\u9000\u51fa<br \/>\ni : \u8f93\u5165\u6a21\u5f0f<br \/>\nesc : \u7ed3\u675f\u8f93\u5165\u6a21\u5f0f<br \/>\nrmdir : \u5220\u9664\u6587\u4ef6\u5939<br \/>\npwd : \u663e\u793a\u5f53\u524d\u76ee\u5f55<br \/>\nls : \u663e\u793a\u6587\u4ef6\u5217\u8868<br \/>\nls -a : \u68c0\u67e5\u9690\u85cf\u6587\u4ef6\u5939<br \/>\ngit : \u663e\u793a\u5e2e\u52a9\u4fe1\u606f<br \/>\ngit config \u2015global use.name \u201cKeishi\u201d : \u8bbe\u7f6e\u7528\u6237\u540d\u4e3a\u201cKeishi\u201d<br \/>\ngit config \u2015global user.email \u201c(mail address)@gmail.com\u201d : \u8bbe\u7f6e\u7528\u6237\u90ae\u7bb1\u4e3a\u201c(mail address)@gmail.com\u201d<br \/>\ngit config \u2015list : \u67e5\u770b\u6ce8\u518c\u4fe1\u606f<br \/>\n(\u521b\u5efa&#8221;My work&#8221;\u6587\u4ef6\u5939\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4ed3\u5e93\u3002\u5de5\u4f5c\u8bb0\u5f55\u5c06\u8bb0\u5f55\u5728\u540d\u4e3a&#8221;.git&#8221;\u7684\u9690\u85cf\u6587\u4ef6\u5939\u4e2d)<br \/>\nmkdir mywork : \u521b\u5efa\u6587\u4ef6\u5939mywork<br \/>\ncd work : \u5207\u6362\u5230work\u6587\u4ef6\u5939<br \/>\ngit init : \u521b\u5efa\u4ed3\u5e93<br \/>\ngit status : \u68c0\u67e5\u4ed3\u5e93\u548c\u6682\u5b58\u533a\u72b6\u6001<br \/>\n\u2192 &#8220;Initial commit&#8221; = \u521d\u59cb\u72b6\u6001<br \/>\n\u2192 &#8220;Untracked files&#8221; = \u672a\u6682\u5b58\u7684\u72b6\u6001<br \/>\n\u2192 &#8220;working directory clean&#8221; = ok<br \/>\n\u2192 &#8220;modified&#8221; : \u8868\u793a\u5df2\u4fee\u6539<br \/>\ngit add readme.txt : \u5c06readme.txt\u6682\u5b58<br \/>\ngit commit : \u542f\u52a8vim\u5e76\u586b\u5199\u63d0\u4ea4\u4fe1\u606f<br \/>\ngit log : \u786e\u8ba4\u8bb0\u5f55<br \/>\ngit add . : \u5c06\u6240\u6709\u6587\u4ef6\u6682\u5b58<br \/>\ngit commit -a -m \u201c2nd commit\u201d : -a = \u540c\u65f6\u6682\u5b58\u548c\u63d0\u4ea4\uff0c-m = \u6307\u5b9a\u63d0\u4ea4\u4fe1\u606f<br \/>\ngit log \u2015online : \u4ec5\u663e\u793a\u63d0\u4ea4\u4fe1\u606f<br \/>\ngit log -1 : \u4ec5\u663e\u793a\u6700\u8fd1\u7684\u65e5\u5fd7\uff08\u6570\u5b57\u4e3a\u663e\u793a\u7684\u63d0\u4ea4\u65e5\u5fd7\u6570\u91cf\uff09<br \/>\ngit status -s : \u7b80\u7565\u663e\u793a<br \/>\ngit diff : \u6bd4\u8f83\u6682\u5b58\u548c\u5de5\u4f5c\u76ee\u5f55<br \/>\ngit diff \u2015cached : \u6bd4\u8f83\u6700\u65b0\u63d0\u4ea4\u548c\u6682\u5b58\u533a<br \/>\ngit diff HEAD : \u6bd4\u8f83\u6700\u65b0\u63d0\u4ea4\u548c\u5de5\u4f5c\u76ee\u5f55<br \/>\ngit checkout readme.txt : \u5c06\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u6062\u590d\u5230\u4e4b\u524d\u7684\u72b6\u6001<br \/>\ngit reset readme.txt : \u5c06\u6682\u5b58\u533a\u7684\u6307\u5b9a\u6587\u4ef6\u6062\u590d\u5230\u4e0a\u4e00\u4e2a\u72b6\u6001<br \/>\ngit revert HEAD (:wq) : \u64a4\u9500\u6700\u65b0\u63d0\u4ea4<br \/>\ngit add . : \u5c06\u6240\u6709\u6587\u4ef6\u6682\u5b58<br \/>\ngit commit -a -m \u201c2nd commit\u201d : -a = \u540c\u65f6\u6682\u5b58\u548c\u63d0\u4ea4\uff0c-m = \u6307\u5b9a\u63d0\u4ea4\u4fe1\u606f<br \/>\ngit log \u2015online : \u4ec5\u663e\u793a\u63d0\u4ea4\u4fe1\u606f<br \/>\ngit log -1 : \u4ec5\u663e\u793a\u6700\u8fd1\u7684\u65e5\u5fd7\uff08\u6570\u5b57\u4e3a\u663e\u793a\u7684\u63d0\u4ea4\u65e5\u5fd7\u6570\u91cf\uff09<br \/>\ngit status -s : \u7b80\u7565\u663e\u793a<br \/>\ngit diff : \u6bd4\u8f83\u6682\u5b58\u548c\u5de5\u4f5c\u76ee\u5f55<br \/>\ngit diff \u2015cached : \u6bd4\u8f83\u6700\u65b0\u63d0\u4ea4\u548c\u6682\u5b58\u533a<br \/>\ngit diff HEAD : \u6bd4\u8f83\u6700\u65b0\u63d0\u4ea4\u548c\u5de5\u4f5c\u76ee\u5f55<br \/>\ngit checkout readme.txt : \u5c06\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u6062\u590d\u5230\u4e4b\u524d\u7684\u72b6\u6001<br \/>\ngit reset readme.txt : \u5c06\u6682\u5b58\u533a\u7684\u6307\u5b9a\u6587\u4ef6\u6062\u590d\u5230\u4e0a\u4e00\u4e2a\u72b6\u6001<br \/>\ngit revert HEAD (:wq) : \u64a4\u9500\u6700\u65b0\u63d0\u4ea4<\/p>\n<p>\u26aa\ufe0e\u5206\u652f\uff1a\u6839\u636e\u5de5\u4f5c\u5185\u5bb9\u5206\u652f\u5b58\u50a8\u5e93\u7684\u529f\u80fd\uff08\u9ed8\u8ba4\u4e3a\u201cmaster\u201d\uff09<br \/>\ngit branch\uff1a\u68c0\u67e5\u5206\u652f<br \/>\ngit branch add_html\uff1a\u521b\u5efa\u5206\u652f<br \/>\ngit checkout add_html\uff1a\u5207\u6362\u5206\u652f<br \/>\ngit checkout master<br \/>\n\u2192 git merge add_html\uff08\u5206\u652f\u540d\u79f0\uff09\uff1a\u5c06\u5206\u652f\u5408\u5e76\u5230master<br \/>\n\u2192 git branch -d add_html\uff1a\u5220\u9664\u5206\u652f<br \/>\ngit checkout -b &lt;\u5206\u652f\u540d\u79f0&gt;\uff1a\u521b\u5efa\u5e76\u5207\u6362\u5206\u652f<br \/>\ngit status\uff1a\u68c0\u67e5\u51b2\u7a81\u72b6\u6001<br \/>\n\u2192 \u5f53\u5728\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u51b2\u7a81\u6587\u4ef6\u65f6\uff0c\u201c&lt;&lt; &gt;&gt;\u201d\u4e2d\u7684\u90e8\u5206\u8868\u793a\u51b2\u7a81\u7684\u5730\u65b9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e\u6211\u8bb0\u5f55\u4e86\u4f7f\u7528Git\u8fdb\u884c\u4e2a\u4eba\u4f7f\u7528\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u6211\u4e0e\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002 \u5982\u679c\u6709\u7528\u7684\u8bdd\uff0c\u8bf7\u968f\u610f\u4f7f\u7528\u3002 :wq : \u4fdd\u5b58 [&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-37450","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 \u547d\u4ee4\u603b\u7ed3 - 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-\u547d\u4ee4\u603b\u7ed3\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git \u547d\u4ee4\u603b\u7ed3\" \/>\n<meta property=\"og:description\" content=\"\u7531\u4e8e\u6211\u8bb0\u5f55\u4e86\u4f7f\u7528Git\u8fdb\u884c\u4e2a\u4eba\u4f7f\u7528\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u6211\u4e0e\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002 \u5982\u679c\u6709\u7528\u7684\u8bdd\uff0c\u8bf7\u968f\u610f\u4f7f\u7528\u3002 :wq : \u4fdd\u5b58 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/git-\u547d\u4ee4\u603b\u7ed3\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-11T09:32:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T01:28:37+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-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/\",\"name\":\"Git \u547d\u4ee4\u603b\u7ed3 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-08-11T09:32:12+00:00\",\"dateModified\":\"2024-01-15T01:28:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git \u547d\u4ee4\u603b\u7ed3\"}]},{\"@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-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Git \u547d\u4ee4\u603b\u7ed3 - 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-\u547d\u4ee4\u603b\u7ed3\/","og_locale":"zh_CN","og_type":"article","og_title":"Git \u547d\u4ee4\u603b\u7ed3","og_description":"\u7531\u4e8e\u6211\u8bb0\u5f55\u4e86\u4f7f\u7528Git\u8fdb\u884c\u4e2a\u4eba\u4f7f\u7528\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u6211\u4e0e\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002 \u5982\u679c\u6709\u7528\u7684\u8bdd\uff0c\u8bf7\u968f\u610f\u4f7f\u7528\u3002 :wq : \u4fdd\u5b58 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/git-\u547d\u4ee4\u603b\u7ed3\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-08-11T09:32:12+00:00","article_modified_time":"2024-01-15T01:28:37+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-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/","name":"Git \u547d\u4ee4\u603b\u7ed3 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-08-11T09:32:12+00:00","dateModified":"2024-01-15T01:28:37+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Git \u547d\u4ee4\u603b\u7ed3"}]},{"@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-%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37450","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=37450"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37450\/revisions"}],"predecessor-version":[{"id":58208,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37450\/revisions\/58208"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}