{"id":1882,"date":"2017-01-04T11:28:39","date_gmt":"2017-01-04T03:28:39","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=1882"},"modified":"2026-08-18T12:09:37","modified_gmt":"2026-08-18T04:09:37","slug":"git%e5%bf%ab%e6%8d%b7%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=1882","title":{"rendered":"Git\u5feb\u6377\u4f7f\u7528"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">Git<\/strong> \u662f\u514d\u8d39\u3001\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u6765\u654f\u6377\u9ad8\u6548\u5730\u5904\u7406\u6216\u5c0f\u6216\u5927\u7684\u9879\u76ee\u3002\u5b83\u6700\u521d\u670d\u52a1\u4e8e Linux \u5185\u6838\u5f00\u53d1\uff1a\u4e0d\u9700\u8981\u670d\u52a1\u5668\u7aef\u8f6f\u4ef6\u4e5f\u80fd\u505a\u7248\u672c\u63a7\u5236\uff0c\u6e90\u7801\u53d1\u5e03\u548c\u4ea4\u6d41\u5f88\u65b9\u4fbf\uff0c\u901f\u5ea6\u4e5f\u5feb\uff0c\u5408\u5e76\u8ffd\u8e2a\uff08merge tracing\uff09\u80fd\u529b\u5c24\u5176\u51fa\u8272\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u548c CVS\u3001Subversion \u8fd9\u7c7b\u96c6\u4e2d\u5f0f\u5de5\u5177\u4e0d\u540c\uff0cGit \u91c7\u7528\u5206\u5e03\u5f0f\u7248\u672c\u5e93\u3002\u65e5\u5e38\u628a\u6539\u52a8\u5148\u63d0\u4ea4\u5230\u672c\u5730\u5e93\uff0c\u518d\u63a8\u5230\u8fdc\u7a0b\uff08\u4f8b\u5982 GitHub\uff09\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u5b89\u88c5\u73af\u5883<\/h2>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u4e0b\u8f7d Git\uff0c\u5b98\u7f51\uff1a<a href=\"https:\/\/git-scm.com\/\">https:\/\/git-scm.com\/<\/a><\/section>\n<\/li>\n<li>\n<section>\u4e0b\u8f7d TortoiseGit \u53ef\u89c6\u5316\u5ba2\u6237\u7aef\uff0c\u5b98\u7f51\uff1a<a href=\"https:\/\/tortoisegit.org\/\">https:\/\/tortoisegit.org\/<\/a><\/section>\n<\/li>\n<\/ul>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u5e38\u7528\u547d\u4ee4<\/h2>\n<p style=\"margin: 1em 0px;\">\u628a\u6587\u4ef6\u4fdd\u5b58\u5230\u4ee3\u7801\u5e93\uff0c\u53ef\u4ee5\u6309\u300c\u672c\u5730\u5e93 \u2192 \u8fdc\u7a0b\u5e93\u300d\u4e24\u6b65\u8d70\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">----\u4fdd\u5b58\u5230\u672c\u5730\u5e93----\n\n1.\u521b\u5efa\u672c\u5730\u7248\u672c\u5e93:\n  git init\n\n2.\u6dfb\u52a0\u6587\u4ef6\u5230\u672c\u5730\u7248\u672c\u5e93\n  git add .\n\n3.\u63d0\u4ea4\u6587\u4ef6\u5230\u672c\u5730\u7248\u672c\u5e93\n  git commit -m \"first commit\"\n\n4.\u7248\u672c\u5e93\u56de\u9000\n  git reset --hard HEAD\n\n-----\u63d0\u4ea4\u5230\u8fdc\u7a0b\u5e93(\u4f7f\u7528github\u5e93)------\n5. git remote add origin https:\/\/github.com\/yihu\/myRepository.git\n\n6. git push -u origin master\n\n7. git clone https:\/\/github.com\/yihu0817\/myRepository.git<\/code><\/pre>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u547d\u4ee4<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git init<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u521b\u5efa\u672c\u5730\u7248\u672c\u5e93<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git add .<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6dfb\u52a0\u6587\u4ef6\u5230\u672c\u5730\u7248\u672c\u5e93<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git commit -m &#8220;first commit&#8221;<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u63d0\u4ea4\u5230\u672c\u5730\u7248\u672c\u5e93<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git reset &#8211;hard HEAD<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7248\u672c\u5e93\u56de\u9000<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git remote add origin \u2026<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5173\u8054\u8fdc\u7a0b\u5e93\uff08GitHub\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git push -u origin master<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u63a8\u9001\u5230\u8fdc\u7a0b<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">git clone \u2026<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u514b\u9686\u8fdc\u7a0b\u5e93<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u53ef\u89c6\u5316\u64cd\u4f5c<\/h2>\n<p style=\"margin: 1em 0px;\">\u4e5f\u53ef\u4ee5\u7528 TortoiseGit \u505a\u53ef\u89c6\u5316\u64cd\u4f5c\u3002\u66f4\u5b8c\u6574\u7684\u8bb2\u89e3\u89c1 Git \u6559\u7a0b &#8211; <a href=\"http:\/\/www.liaoxuefeng.com\/wiki\/0013739516305929606dd18361248578c67b8067c8c017b000\">\u5ed6\u96ea\u5cf0\u7684\u5b98\u65b9\u7f51\u7ad9<\/a>\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u672c\u5730\u7528 git init \/ add \/ commit \u7ba1\u7248\u672c\uff0c\u8fdc\u7a0b\u7528 remote add\u3001push\u3001clone \u540c\u6b65\uff1b\u547d\u4ee4\u884c\u548c TortoiseGit \u90fd\u80fd\u7528\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Git \u662f\u514d\u8d39\u3001\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u6765\u654f\u6377\u9ad8\u6548\u5730\u5904\u7406\u6216\u5c0f\u6216\u5927\u7684\u9879\u76ee\u3002\u5b83\u6700\u521d\u670d\u52a1\u4e8e Linux \u5185\u6838\u5f00\u53d1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[88],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1882"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1882"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1882\/revisions"}],"predecessor-version":[{"id":1886,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1882\/revisions\/1886"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}