{"id":21194,"date":"2024-11-19T16:49:26","date_gmt":"2024-11-19T08:49:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21194\/"},"modified":"2024-11-19T16:49:26","modified_gmt":"2024-11-19T08:49:26","slug":"git%e5%91%bd%e4%bb%a4%e6%80%8e%e4%b9%88%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21194\/","title":{"rendered":"git\u547d\u4ee4\u600e\u4e48\u7528"},"content":{"rendered":"<blockquote><p>\n  git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u4e8e\u8ddf\u8e2a\u4ee3\u7801\u5e93\u4e2d\u7684\u66f4\u6539\uff0c\u5b9e\u73b0\u534f\u4f5c\u5f00\u53d1\u3002\u5e38\u7528 git \u547d\u4ee4\u5305\u62ec\uff1a\u521d\u59cb\u5316\u4ee3\u7801\u5e93\uff1agit init\u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\u57df\uff1agit add \u63d0\u4ea4\u66f4\u6539\uff1agit commit -m &#8220;\u63d0\u4ea4\u4fe1\u606f&#8221;\u62c9\u53d6\u8fdc\u7a0b\u4ee3\u7801\u5e93\u66f4\u6539\uff1agit pull\u63a8\u9001\u672c\u5730\u4ee3\u7801\u5e93\u66f4\u6539\uff1agit push\u521b\u5efa\u5206\u652f\uff1agit branch \u5207\u6362\u5230\u5206\u652f\uff1agit checkout \u5408\u5e76\u5206\u652f\uff1agit merge\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040911152319565.jpg\" class=\"aligncenter\" title=\"git\u547d\u4ee4\u600e\u4e48\u7528\u63d2\u56fe\" alt=\"git\u547d\u4ee4\u600e\u4e48\u7528\u63d2\u56fe\" \/><\/p>\n<p><strong>Git \u547d\u4ee4\u6307\u5357<\/strong><\/p>\n<p><strong>\u4ec0\u4e48\u662f Git\uff1f<\/strong><\/p>\n<p>Git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u4e8e\u8ddf\u8e2a\u4ee3\u7801\u5e93\u4e2d\u7684\u66f4\u6539\u5e76\u534f\u4f5c\u5f00\u53d1\u3002<\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Git \u547d\u4ee4<\/strong><\/p>\n<p>\u4f7f\u7528 Git \u547d\u4ee4\uff0c\u60a8\u53ef\u4ee5\u6267\u884c\u5404\u79cd\u64cd\u4f5c\u6765\u7ba1\u7406\u4ee3\u7801\u5e93\u3002\u4ee5\u4e0b\u662f\u5e38\u7528 Git \u547d\u4ee4\uff1a<\/p>\n<p><strong>\u521d\u59cb\u5316\u4ee3\u7801\u5e93\uff1a<\/strong><\/p>\n<pre>git init<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff1a<\/strong><\/p>\n<pre>git add &lt;\u6587\u4ef6\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63d0\u4ea4\u66f4\u6539\uff1a<\/strong><\/p>\n<pre>git commit -m \"\u63d0\u4ea4\u4fe1\u606f\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u62c9\u53d6\u8fdc\u7a0b\u4ee3\u7801\u5e93\u66f4\u6539\uff1a<\/strong><\/p>\n<pre>git pull<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63a8\u9001\u672c\u5730\u4ee3\u7801\u5e93\u66f4\u6539\uff1a<\/strong><\/p>\n<pre>git push<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u521b\u5efa\u5206\u652f\uff1a<\/strong><\/p>\n<pre>git branch &lt;\u5206\u652f\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5207\u6362\u5230\u5206\u652f\uff1a<\/strong><\/p>\n<pre>git checkout &lt;\u5206\u652f\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5408\u5e76\u5206\u652f\uff1a<\/strong><\/p>\n<pre>git merge &lt;\u5206\u652f\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u521b\u5efa\u6807\u7b7e\uff1a<\/strong><\/p>\n<pre>git tag &lt;\u6807\u7b7e\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u56de\u6eda\u5230\u7279\u5b9a\u63d0\u4ea4\uff1a<\/strong><\/p>\n<pre>git reset --hard &lt;\u63d0\u4ea4\u54c8\u5e0c&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u67e5\u770b\u63d0\u4ea4\u5386\u53f2\uff1a<\/strong><\/p>\n<pre>git log<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u67e5\u770b\u6587\u4ef6\u72b6\u6001\uff1a<\/strong><\/p>\n<pre>git status<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u66f4\u591a\u547d\u4ee4\uff1a<\/strong><\/p>\n<p>\u9664\u4e86\u57fa\u672c\u547d\u4ee4\u5916\uff0cGit \u8fd8\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>  cherry-pick\uff1a\u9009\u62e9\u6027\u5730\u4ece\u53e6\u4e00\u4e2a\u5206\u652f\u5408\u5e76\u63d0\u4ea4\u3002<\/li>\n<li>git bisect\uff1a\u67e5\u627e\u5bfc\u81f4\u9519\u8bef\u63d0\u4ea4\u3002<\/li>\n<li>git rebase\uff1a\u91cd\u65b0\u5e94\u7528\u63d0\u4ea4\u5230\u53e6\u4e00\u5206\u652f\u3002<\/li>\n<\/ul>\n<p><strong>\u8fdb\u9636\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 -v \u9009\u9879\u67e5\u770b\u8be6\u7ec6\u8f93\u51fa\u3002<\/li>\n<li>\u4f7f\u7528\u522b\u540d\u7b80\u5316\u5e38\u7528\u547d\u4ee4\uff0c\u4f8b\u5982 alias co=checkout\u3002<\/li>\n<li>\u4e86\u89e3 Git \u5206\u652f\u6a21\u578b\uff0c\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u5206\u652f\u3002<\/li>\n<li>\u5b9a\u671f\u63d0\u4ea4\u66f4\u6539\uff0c\u4ee5\u9632\u6b62\u3002<\/li>\n<li>\u4f7f\u7528 Git GUI \u5de5\u5177\uff08\u4f8b\u5982 SourceTree \u6216 GitKraken\uff09\u53ef\u7b80\u5316 Git \u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u547d\u4ee4\u600e\u4e48\u7528\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u4e8e\u8ddf\u8e2a\u4ee3\u7801\u5e93\u4e2d\u7684\u66f4\u6539\uff0c\u5b9e\u73b0\u534f\u4f5c\u5f00\u53d1\u3002\u5e38\u7528 git \u547d\u4ee4\u5305\u62ec\uff1a\u521d\u59cb\u5316\u4ee3\u7801\u5e93\uff1agit init\u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\u57df\uff1agit add \u63d0\u4ea4\u66f4\u6539\uff1agit commit -m &#8220;\u63d0\u4ea4\u4fe1\u606f&#8221;\u62c9\u53d6\u8fdc\u7a0b\u4ee3\u7801\u5e93\u66f4\u6539\uff1agit pull\u63a8\u9001\u672c\u5730\u4ee3\u7801\u5e93\u66f4\u6539\uff1agit push\u521b\u5efa\u5206\u652f\uff1agit branch \u5207\u6362\u5230\u5206\u652f\uff1agit checkout \u5408\u5e76\u5206\u652f\uff1agit merge Git \u547d\u4ee4\u6307\u5357 \u4ec0\u4e48\u662f Git\uff1f Git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u7528\u4e8e\u8ddf\u8e2a\u4ee3\u7801\u5e93\u4e2d\u7684\u66f4\u6539\u5e76\u534f\u4f5c\u5f00\u53d1\u3002 \u5982\u4f55\u4f7f\u7528 Git \u547d\u4ee4 \u4f7f\u7528 Git \u547d\u4ee4\uff0c\u60a8\u53ef\u4ee5\u6267\u884c\u5404\u79cd\u64cd\u4f5c\u6765\u7ba1\u7406\u4ee3\u7801\u5e93\u3002\u4ee5\u4e0b\u662f\u5e38\u7528 Git \u547d\u4ee4\uff1a \u521d\u59cb\u5316\u4ee3\u7801\u5e93\uff1a git init \u767b\u5f55\u540e\u590d\u5236 \u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff1a git add &lt;\u6587\u4ef6\u540d&gt; \u767b\u5f55\u540e\u590d\u5236 \u63d0\u4ea4\u66f4\u6539\uff1a git commit -m &#8220;\u63d0\u4ea4\u4fe1\u606f&#8221; \u767b\u5f55\u540e\u590d\u5236 \u62c9\u53d6\u8fdc\u7a0b\u4ee3\u7801\u5e93\u66f4\u6539\uff1a git pull \u767b\u5f55\u540e\u590d\u5236 \u63a8\u9001\u672c\u5730\u4ee3\u7801\u5e93\u66f4\u6539\uff1a git push \u767b\u5f55\u540e\u590d\u5236 \u521b\u5efa\u5206\u652f\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21194","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=21194"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21194\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}