{"id":37328,"date":"2023-05-04T15:40:09","date_gmt":"2023-03-22T14:01:58","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/"},"modified":"2024-04-30T02:35:58","modified_gmt":"2024-04-29T18:35:58","slug":"git%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/","title":{"rendered":"Git\u603b\u7ed3"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u662f\u5173\u4e8e\u65b0Linux\u6559\u79d1\u4e66\u7684\u5907\u5fd8\u5f55\u3002<br \/>\n\u6211\u5c06\u4ee5\u5907\u5fd8\u5f55\u7684\u5f62\u5f0f\u8bb0\u5f55\u4e00\u4e9b\u7b14\u8bb0\u3002<br \/>\n\u8fd9\u672c\u4e66\u975e\u5e38\u6613\u61c2\uff0c\u6211\u5f3a\u70c8\u63a8\u8350\u5927\u5bb6\u53bb\u9605\u8bfb\u4e00\u4e0b\u3002<br \/>\n\u5728\u8fd9\u91cc\uff0c\u6211\u5c06\u603b\u7ed3\u6709\u5173\u7248\u672c\u63a7\u5236\u7cfb\u7edfGit\u7684\u5185\u5bb9\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/2-0.png\" alt=\"image.png\" \/><\/div>\n<h1>Git\u662f\u4ec0\u4e48<\/h1>\n<p>Git\u662f\u4e00\u79cd\u7528\u4e8e\u4fdd\u5b58\u548c\u7ba1\u7406\u6587\u4ef6\u66f4\u6539\u8bb0\u5f55\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002<br \/>\n\u7531\u4e8eGit\u88ab\u5e7f\u6cdb\u7528\u4f5c\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5728\u5927\u591a\u6570\u53d1\u884c\u7248\u4e2d\u90fd\u63d0\u4f9b\u4e86\u5b83\u3002<br \/>\n\u8bf7\u901a\u8fc7git &#8211;version\u7b49\u547d\u4ee4\u786e\u8ba4\u662f\u5426\u5df2\u5b89\u88c5\u5b83\u3002\u5982\u679c\u5df2\u5b89\u88c5\uff0c\u5e94\u8be5\u4f1a\u663e\u793a\u7248\u672c\u53f7\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git --version\r\ngit version 2.32.1 (Apple Git-133)\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8981\u5b89\u88c5\uff0c\u8bf7\u5b89\u88c5\u4e00\u4e2a\u53eb\u505agit-core\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo apt-get install git-core\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fWindows\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8bf7\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>Git \u7684\u4e3b\u8981\u529f\u80fd\u6709\u4e24\u4e2a\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3057\u3066\u3044\u3064 \u8ab0\u304c \u3069\u306e\u3088\u3046\u306a\u76ee\u7684\u3067 \u3069\u306e\u3088\u3046\u306a\u5909\u66f4\u3092\u52a0\u3048\u305f\u306e\u304b\u3092\u8a18\u9332\u3057\u95b2\u89a7\u3067\u304d\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u904e\u53bb\u306e\u72b6\u614b\u306b\u623b\u3059\u3002<\/ul>\n<h1>Git\u7684\u521d\u59cb\u8bbe\u7f6e<\/h1>\n<p>\u4e3a\u4e86\u4f7f\u7528Git\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u521d\u59cb\u8bbe\u7f6e\uff0c\u5176\u4e2d\u5305\u62ec\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<br \/>\n\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528git config\u547d\u4ee4\u8fdb\u884c\u521d\u59cb\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git config --global user.name '&lt;\u30e6\u30fc\u30b6\u30fc\u540d&gt;'\r\n$ git config --global user.email '&lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;'\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u8bbe\u7f6e\u4e86\u4f7f\u7528Git\u7684\u4eba\u7684\u4fe1\u606f\uff0c\u5f53\u5bf9\u6587\u4ef6\u8fdb\u884c\u66f4\u6539\u65f6\u53ef\u4ee5\u53c2\u8003\u8c01\u505a\u51fa\u4e86\u66f4\u6539\u3002<\/p>\n<p>\u8bbe\u5b9a\u7684\u4fe1\u606f\u5c06\u4fdd\u5b58\u5728 ~\/.gitconfig \u6587\u4ef6\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>[user]\r\n        name = &lt;\u30e6\u30fc\u30b6\u30fc\u540d&gt;\r\n        email = &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;\r\n<\/code><\/pre>\n<h1>\u521b\u5efa\u5b58\u50a8\u5e93\u3002<\/h1>\n<p>\u9996\u5148\uff0c\u4ee3\u7801\u5e93\u662f\u4ec0\u4e48\uff1f<\/p>\n<blockquote><p>Git\u662f\u4fdd\u5b58\u6587\u4ef6\u66f4\u6539\u7684\u5730\u65b9\u3002\u6240\u6709\u6587\u4ef6\u66f4\u6539\u7684\u5386\u53f2\u8bb0\u5f55\u90fd\u4f1a\u6ce8\u518c\u5230\u8fd9\u4e2a\u5b58\u50a8\u5e93\u4e2d\u3002\u5f53\u9700\u8981\u56de\u6eda\u5230\u8fc7\u53bb\u7684\u6587\u4ef6\u72b6\u6001\u65f6\uff0c\u4e5f\u4f1a\u4ece\u8fd9\u4e2a\u5b58\u50a8\u5e93\u4e2d\u63d0\u53d6\u5185\u5bb9\u3002<\/p><\/blockquote>\n<h2>\u521d\u59cb\u5316 Git<\/h2>\n<p>\u5728\u60a8\u5e0c\u671b\u8fdb\u884c\u7248\u672c\u7ba1\u7406\u7684\u76ee\u5f55\u4e2d\u6267\u884cgit init\u547d\u4ee4\u6765\u521b\u5efa\u5b58\u50a8\u5e93\u3002\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u5c06\u8981\u8fdb\u884c\u7248\u672c\u7ba1\u7406\u7684\u76ee\u5f55\u88ab\u79f0\u4e3a\u5de5\u4f5c\u533a\u3002Git\u7528\u4e8e\u7ba1\u7406\u5de5\u4f5c\u533a\u5185\u7684\u76ee\u5f55\u548c\u6587\u4ef6\u7684\u53d8\u66f4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git init\r\n<\/code><\/pre>\n<p>\u5f53\u4f60\u6267\u884c\u540e\uff0c\u5728\u6267\u884c\u7684\u76ee\u5f55\u4e0b\u4f1a\u751f\u6210\u4e00\u4e2a\u540d\u4e3a.git\u7684\u6587\u4ef6\u5939\u3002\u8fd9\u4e2a.git\u6587\u4ef6\u5939\u662fGit\u5b58\u50a8\u5e93\u7684\u5b9e\u4f53\u3002\u7531\u4e8e\u5b58\u50a8\u5e93(.git)\u4e2d\u7684\u6587\u4ef6\u5df2\u88abGit\u8f6c\u6362\u4e3a\u7279\u6b8a\u683c\u5f0f\uff0c\u6240\u4ee5\u65e0\u6cd5\u76f4\u63a5\u5728\u7f16\u8f91\u5668\u7b49\u4e2d\u8fdb\u884c\u66f4\u6539\u3002<\/p>\n<h1>\u6dfb\u52a0\u5230\u5b58\u50a8\u5e93\u4e2d<\/h1>\n<p>\u5982\u679c\u5bf9\u6587\u4ef6\u8fdb\u884c\u4e86\u4efb\u4f55\u66f4\u6539\uff0c\u5c31\u4f1a\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u5b58\u50a8\u5e93\u4e2d\u3002\u8981\u6dfb\u52a0\u66f4\u6539\uff0c\u53ef\u4ee5\u4f7f\u7528git add\u548cgit commit\u8fd9\u4e24\u4e2a\u547d\u4ee4\u3002<\/p>\n<h2>\u6dfb\u52a0\u5230\u7248\u672c\u63a7\u5236<\/h2>\n<p>git add\u662f\u4e00\u6761\u547d\u4ee4\uff0c\u7528\u4e8e\u6307\u5b9a\u8981\u5c06\u54ea\u4e9b\u6587\u4ef6\u6dfb\u52a0\u5230\u5b58\u50a8\u5e93\u4f5c\u4e3a\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git add &lt;\u30d5\u30a1\u30a4\u30eb\u540d&gt;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u60f3\u8981\u6dfb\u52a0\u6240\u6709\u6587\u4ef6\uff0c\u8bf7\u6307\u5b9a\u5706\u70b9\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git add .\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u60f3\u6279\u91cf\u6dfb\u52a0\u6240\u6709\u5df2\u66f4\u6539\u7684\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528-u\u9009\u9879\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<br \/>\n\u4f46\u662f\u8bf7\u6ce8\u610f\uff0c\u65b0\u521b\u5efa\u4e14\u4ece\u672a\u63d0\u4ea4\u7684\u6587\u4ef6\u5c06\u4e0d\u4f1a\u5305\u62ec\u5728\u5185\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git add -u\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u60f3\u6dfb\u52a0\u5305\u62ec\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u5728\u5185\u7684\u6240\u6709\u7f16\u8f91\u8fc7\u7684\u6587\u4ef6\uff0c\u8bf7\u4f7f\u7528 -A \u9009\u9879\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git add -A\r\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u65f6\u5019\u4ed3\u5e93\u8fd8\u6ca1\u6709\u8fdb\u884c\u4efb\u4f55\u66f4\u6539\u7684\u767b\u8bb0\u3002<br \/>\n\u662f\u5728\u7b49\u5f85\u5c06\u66f4\u6539\u63d0\u4ea4\u5230\u4ed3\u5e93\u7684\u72b6\u6001\u5417\uff1f<\/p>\n<h2>\u63d0\u4ea4git<\/h2>\n<p>\u5f53\u4f60\u4f7f\u7528 git add \u547d\u4ee4\u6307\u5b9a\u8981\u6dfb\u52a0\u5230\u53d8\u66f4\u5386\u53f2\u7684\u6587\u4ef6\u540e\uff0c\u901a\u8fc7\u4f7f\u7528 git commit \u547d\u4ee4\u5c06\u53d8\u66f4\u5b9e\u9645\u6dfb\u52a0\uff08\u53cd\u6620\uff09\u5230\u4ed3\u5e93\u3002\u5728\u6267\u884c git commit \u547d\u4ee4\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 -m \u9009\u9879\u8f93\u5165\u4e0e\u4fee\u6b63\u76f8\u5173\u7684\u6d88\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git commit\u3000-m &lt;\u4fee\u6b63\u306e\u30e1\u30c3\u30bb\u30fc\u30b8&gt;\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u6587\u4ef6\u7684\u4fee\u6539\u5185\u5bb9\u5c06\u88ab\u8bb0\u5f55\u5230Git\u4ed3\u5e93\u4e2d\u3002<\/p>\n<h2>\u66f4\u6df1\u5165\u5730\u6316\u6398<\/h2>\n<p>git add\u547d\u4ee4\u4e0d\u4ec5\u4ec5\u662f\u7528\u6765\u6307\u5b9a\u8981\u6dfb\u52a0\u7684\u6587\u4ef6\uff0c\u8fd8\u7528\u6765\u5c06\u7f16\u8f91\u8fc7\u7684\u6587\u4ef6\u653e\u7f6e\u5e76\u6ce8\u518c\u5230\u79f0\u4e3a\u7d22\u5f15\u7684\u5de5\u4f5c\u533a\u7684\u53e6\u4e00\u4e2a\u533a\u57df\u3002<\/p>\n<p>git commit\u662f\u7528\u4e8e\u5c06\u901a\u8fc7git add\u6ce8\u518c\u5230\u7d22\u5f15\u7684\u5185\u5bb9\u63d0\u4ea4\u5230\u4ee3\u7801\u4ed3\u5e93\u7684\u547d\u4ee4\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/44-0.png\" alt=\"\u30ea\u30db\u309a\u30b7\u3099\u30c8\u30ea\u8aac\u660e.png\" \/><\/div>\n<p>\u7d22\u5f15\u53ef\u4ee5\u8bf4\u662f\u8fde\u63a5\u5de5\u4f5c\u533a\u548c\u4ed3\u5e93\u7684\u6865\u6881\u6027\u9886\u57df\u5427\u3002<\/p>\n<h1>\u663e\u793a\u5dee\u5f02<\/h1>\n<h2>git \u72b6\u6001<\/h2>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u662f\u7528\u4e8e\u663e\u793a\u5f53\u524d\u5de5\u4f5c\u6811\u72b6\u6001\u7684\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git status\r\n<\/code><\/pre>\n<p>\u6587\u4ef6\u4e2d\u663e\u793a\u4e3a\u201cmodified:\u201d\u610f\u5473\u7740\u5bf9\u5df2\u8fdb\u884c\u66f4\u6539\u3002<\/p>\n<h2>git diff \u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a\u201cgit\u5dee\u5f02\u201d\u3002<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u786e\u8ba4\u66f4\u6539\u5dee\u5f02\u7684\u547d\u4ee4\u3002<br \/>\n\u5dee\u5f02\u4ee5diff\u547d\u4ee4\u7684\u7edf\u4e00\u683c\u5f0f\u663e\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git diff\r\n<\/code><\/pre>\n<h1>\u67e5\u770b\u66f4\u6539\u5386\u53f2<\/h1>\n<p>\u53ef\u4ee5\u4f7f\u7528git log\u547d\u4ee4\u6765\u67e5\u770b\u53d8\u66f4\u5c65\u5386\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git log\r\n<\/code><\/pre>\n<p>The following four changes will be displayed in the change history.<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">commit:\u30b3\u30df\u30c3\u30c8\u3092\u7279\u5b9a\u3059\u308b\u4e00\u610f\u306e\u30b3\u30df\u30c3\u30c8\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\uff0840\u6587\u5b57\u306e\u6587\u5b57\u5217\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Author:\u5909\u66f4\u3092\u52a0\u3048\u305f\u30e6\u30fc\u30b6\u540d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Date:\u5909\u66f4\u3092\u52a0\u3048\u305f\u65e5\u6642<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8<\/ul>\n<p>\u901a\u8fc7\u6dfb\u52a0-p\u9009\u9879\uff0c\u60a8\u53ef\u4ee5\u540c\u65f6\u786e\u8ba4\u5dee\u5f02\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git log -p\r\n<\/code><\/pre>\n<p>\u8981\u4f7f\u7528git diff\u6307\u4ee4\uff0c\u5e76\u5728\u5176\u540e\u6307\u5b9a\u63d0\u4ea4\u7684\u5bf9\u8c61\u540d\u79f0\uff0c\u5c31\u80fd\u591f\u786e\u8ba4\u8be5\u63d0\u4ea4\u65f6\u7684\u5dee\u5f02\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git diff &lt;\u30b3\u30df\u30c3\u30c8\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d&gt;\r\n<\/code><\/pre>\n<h1>\u6062\u590d\u539f\u72b6<\/h1>\n<p>\u4ee5\u4e0b\u662fGit\u7684\u4e3b\u8981\u529f\u80fd\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5c06\u6587\u4ef6\u6062\u590d\u5230\u8fc7\u53bb\u7684\u72b6\u6001\u3002\u4e0b\u9762\u5c06\u4ecb\u7ecd\u6709\u5173\u6267\u884c\u6062\u590d\u64cd\u4f5c\u7684\u547d\u4ee4\u3002<\/p>\n<h2>\u5de5\u4f5c\u533a\u7684\u6062\u590d<\/h2>\n<p>\u5728\u5de5\u4f5c\u533a\u6062\u590d\u7279\u5b9a\u7684\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u65f6\uff0c\u4f7f\u7528checkout\u547d\u4ee4\u3002checkout\u547d\u4ee4\u4e5f\u7528\u4e8e\u5206\u652f\u5207\u6362\uff0c\u56e0\u6b64\u53ef\u4ee5\u5728\u547d\u4ee4\u4e4b\u540e\u4f7f\u7528&#8211; \u6587\u4ef6\u540d\uff08\u6216\u6587\u4ef6\u5939\u540d\uff09\u6765\u5c06\u66f4\u6539\u8fd8\u539f\u4e3a\u4e4b\u524d\u7684\u72b6\u6001\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git checkout --\u30d5\u30a1\u30a4\u30eb\u540d\r\n$ git checkout --\u30d5\u30a9\u30eb\u30c0\u540d\r\n<\/code><\/pre>\n<p>\u8bf7\u79fb\u52a8\u5230\u5de5\u4f5c\u6811\u7684\u9876\u7ea7\u76ee\u5f55\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5de5\u4f5c\u6811\u7684\u6062\u590d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git checkout HEAD .\r\n<\/code><\/pre>\n<p>\u901a\u8fc7\u8fd9\u6837\u505a\uff0c\u6587\u4ef6\u7684\u7f16\u8f91\u548c\u5220\u9664\u72b6\u6001\u5c06\u5168\u90e8\u6062\u590d\u4e3a\u539f\u59cb\u72b6\u6001\u3002\u8fd8\u5c06\u5220\u9664\u6dfb\u52a0\u5230\u7d22\u5f15\u4e2d\u7684\u5185\u5bb9\uff0c\u56e0\u6b64\u672a\u63d0\u4ea4\u7684\u5dee\u5f02\u4e5f\u5c06\u88ab\u5220\u9664\uff0c\u5de5\u4f5c\u533a\u5c06\u4e0e\u5b58\u50a8\u5e93\u5904\u4e8e\u76f8\u540c\u72b6\u6001\u3002<\/p>\n<h2>\u6062\u590d\u63d0\u4ea4<\/h2>\n<p>\u5982\u679c\u63d0\u4ea4\u4e86\u9519\u8bef\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git revert &lt;\u53d6\u308a\u6d88\u3057\u305f\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d&gt;\r\n<\/code><\/pre>\n<p>\u8fd9\u5c06\u5bfc\u81f4\u63d0\u4ea4\u5185\u5bb9\u88ab\u53d6\u6d88\uff0c\u5e76\u4e14\u9700\u8981\u624b\u52a8\u4fee\u590d\u5dee\u5f02\u540e\u91cd\u65b0\u63d0\u4ea4\uff0c\u76f8\u5f53\u4e8e\u624b\u52a8\u4fee\u6b63\u5e76\u63d0\u4ea4\u4e86\u4fee\u6b63\u5185\u5bb9\u3002<\/p>\n<h1>\u5206\u652f<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/76-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2023-02-27 21.53.36.png\" \/><\/div>\n<p>\u5728\u4e2d\u6587\u4e2d\uff0c\u5927\u5143\u7684\u5206\u652f\u88ab\u79f0\u4e3a\u201c\u4e3b\u5206\u652f\u201d\u6216\u201c\u4e3b\u8981\u5206\u652f\u201d\u3002\u57fa\u672c\u4e0a\uff0c\u63d0\u4ea4\u5c06\u53cd\u6620\u5728\u8fd9\u4e2a\u4e3b\u5206\u652f\u4e0a\u3002<br \/>\n\u6d3e\u751f\u7684\u5206\u652f\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u540d\u79f0\u3002<br \/>\n\u53e6\u5916\uff0cGit\u7684\u5206\u652f\u662f\u6307\u5411\u5206\u5c90\u5386\u53f2\u5f00\u5934\u7684\u63d0\u4ea4\u7684\u6807\u7b7e\u3002<\/p>\n<h2>\u786e\u8ba4\u5206\u652f<\/h2>\n<p>\u5982\u679c\u60f3\u67e5\u770b\u5206\u652f\u5217\u8868\uff0c\u53ef\u4ee5\u4f7f\u7528git branch\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git branch\r\n* master\r\n<\/code><\/pre>\n<p>\u73b0\u5728\u6240\u5728\u7684\u5206\u652f\u662f\u5e26\u6709 * \u7684\u5206\u652f\u540d\u79f0\u3002<\/p>\n<h2>\u521b\u5efa\u5206\u652f<\/h2>\n<p>\u5982\u679c\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5206\u652f\uff0c\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u5206\u652f\u540d\u79f0\u6765\u521b\u5efa\u3002<br \/>\n\u53ef\u4ee5\u5728\u521b\u5efa\u7684\u5206\u652f\u4e2d\u8fdb\u884c\u6d4b\u8bd5\u548c\u4fee\u590d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git branch &lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<h2>\u5207\u6362\u5206\u652f<\/h2>\n<p>\u5982\u679c\u60f3\u8981\u5207\u6362\u5206\u652f\uff0c\u53ef\u4ee5\u4f7f\u7528git checkout\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git checkout &lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<h2>\u5c06\u5206\u652f\u5408\u5e76<\/h2>\n<p>\u4f60\u53ef\u4ee5\u5c06\u5206\u5c90\u521b\u5efa\u7684\u5206\u652f\u5185\u5bb9\u5408\u5e76\u5230\u53e6\u4e00\u4e2a\u5206\u652f\u4e2d\u3002\u5c06\u5206\u652f\u5185\u5bb9\u5408\u5e76\u79f0\u4e3a\u5408\u5e76\u64cd\u4f5c\u3002<br \/>\n\u4ee5\u4e0b\u662f\u5408\u5e76\u5206\u652f\u7684\u6b65\u9aa4\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u7528git checkout\u547d\u4ee4\u5207\u6362\u5230\u60f3\u8981\u5408\u5e76\u7684\u5206\u652f\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>\u4f7f\u7528git merge\u547d\u4ee4\u8fdb\u884c\u5408\u5e76\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git checkout &lt;\u30de\u30fc\u30b8\u5148\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>$ git merge &lt;\u30de\u30fc\u30b8\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<h2>\u5220\u9664\u5206\u652f<\/h2>\n<p>\u53ef\u4ee5\u901a\u8fc7\u5728git branch\u547d\u4ee4\u540e\u52a0\u4e0a-d\u9009\u9879\u6765\u5220\u9664\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git branch -d &lt;\u524a\u9664\u3057\u305f\u3044\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<h1>\u5907\u4efd<\/h1>\n<p>\u5728Git\u4e2d\uff0c\u6240\u6709\u66f4\u6539\u7684\u5386\u53f2\u90fd\u88ab\u4fdd\u5b58\u5728\u4ed3\u5e93\u4e2d\uff0c\u4f46\u5982\u679c\u4e0d\u5c0f\u5fc3\u5220\u9664\u4e86\u8fd9\u4e2a\u4ed3\u5e93\uff0c\u662f\u65e0\u6cd5\u6062\u590d\u7684\u3002\u4e3a\u4e86\u5e94\u5bf9\u8fd9\u79cd\u610f\u5916\u60c5\u51b5\uff0cGit\u5141\u8bb8\u5907\u4efd\u4ed3\u5e93\u3002<\/p>\n<p>\u8fdb\u884c\u5907\u4efd\u7684\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u521b\u5efa\u5907\u4efd\u4ed3\u5e93<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u5c06\u66f4\u6539\u8bb0\u5f55\u53d1\u9001\u5230\u5907\u4efd\u4ed3\u5e93<\/ol>\n<h2>\u521b\u5efa\u7528\u4e8e\u5907\u4efd\u7684\u4ed3\u5e93<\/h2>\n<p>\u9996\u5148\uff0c\u4f7f\u7528mkdir\u547d\u4ee4\u6216\u7c7b\u4f3c\u7684\u65b9\u5f0f\u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684\u6587\u4ef6\u5939\u3002\u5730\u70b9\u53ef\u4ee5\u662f\u4efb\u610f\u7684\u3002<br \/>\n\u8bf7\u5728\u6587\u4ef6\u5939\u540d\u79f0\u672b\u5c3e\u6dfb\u52a0\u201c.git\u201d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ mkdir -p ...\/example.git\r\n<\/code><\/pre>\n<p>Please make sure to navigate to the created folder using the cd command and then execute the git init command. Do not forget to include the &#8211;bare option.<\/p>\n<pre class=\"post-pre\"><code>$ cd ...\/example.git\r\n$ git --bare init\r\n<\/code><\/pre>\n<p>&#8211;bare\u9009\u9879\u662f\u7528\u4e8e\u521b\u5efa\u88f8\u4ed3\u5e93\u7684\u9009\u9879\uff0c\u88f8\u4ed3\u5e93\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u7528\u4e8e\u590d\u5236\u7684\u4ed3\u5e93\u3002\u5177\u4f53\u800c\u8a00\uff0c\u5b83\u662f\u6307\u6ca1\u6709\u5de5\u4f5c\u76ee\u5f55\u7684\u4ed3\u5e93\u3002<\/p>\n<h2>\u5c06\u53d8\u66f4\u5386\u53f2\u53d1\u9001\u5230\u5907\u4efd\u4ed3\u5e93\u4e2d<\/h2>\n<p>\u521b\u5efa\u7528\u4e8e\u5907\u4efd\u7684\u5b58\u50a8\u5e93\u540e\uff0c\u5c06\u539f\u5b58\u50a8\u5e93\u7684\u5185\u5bb9\u53d1\u9001\u5230\u8be5\u5b58\u50a8\u5e93\u3002<br \/>\n\u9996\u5148\u8fd4\u56de\u539f\u5b58\u50a8\u5e93\u3002<br \/>\n\u539f\u5b58\u50a8\u5e93\u662f.git\u6587\u4ef6\u5939\u3002\u79fb\u52a8\u76ee\u6807\u662f\u5305\u542b.git\u6587\u4ef6\u5939\u7684\u76ee\u5f55\uff08\u5de5\u4f5c\u6811\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cd &lt;\u5143\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u30d1\u30b9&gt;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u53ef\u4ee5\u79fb\u52a8\uff0c\u5c06\u66f4\u6539\u8bb0\u5f55\u53d1\u9001\u5230git push\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git push &lt;\u9001\u4fe1\u5148\u30ea\u30dd\u30b8\u30c8\u30ea&gt; &lt;\u9001\u4fe1\u5143\u30d6\u30e9\u30f3\u30c1&gt;:&lt;\u9001\u4fe1\u5148\u30d6\u30e9\u30f3\u30c1&gt;\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u5728\u4e2d\u6587\u5408\u6210\u4ee5\u4e0b\u7684\u53e5\u5b50:<\/p>\n<p>\u8981\u6307\u5b9a\u4fe1\u4ef6\u7684\u76ee\u7684\u5730\u5b58\u50a8\u5e93\uff0c\u8bf7\u63d0\u4f9b\u4e4b\u524d\u521b\u5efa\u7684\u5907\u4efd\u5b58\u50a8\u5e93\u7684\u8def\u5f84\u3002<br \/>\n\u8981\u6307\u5b9a\u4fe1\u4ef6\u7684\u6765\u6e90\u5206\u652f\uff0c\u8bf7\u63d0\u4f9b\u8981\u5907\u4efd\u7684\u5206\u652f\u3002<br \/>\n\u8981\u6307\u5b9a\u4fe1\u4ef6\u7684\u76ee\u6807\u5206\u652f\uff0c\u8bf7\u6307\u5b9a\u5c06\u88ab\u53d1\u9001\u7684\u6765\u6e90\u5206\u652f\u4fdd\u5b58\u5230\u54ea\u4e2a\u5206\u652f\u4e0a\u3002<\/p>\n<p>\u5982\u679c\u53d1\u4ef6\u5206\u652f\u548c\u6536\u4ef6\u5206\u652f\u76f8\u540c\uff0c\u5219\u53ef\u4ee5\u7701\u7565\u5192\u53f7\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git push &lt;\u9001\u4fe1\u5148\u30ea\u30dd\u30b8\u30c8\u30ea&gt; &lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;:\r\n<\/code><\/pre>\n<h2>\u4ece\u5907\u4efd\u4ed3\u5e93\u4e2d\u6062\u590d<\/h2>\n<p>\u5982\u679c\u60f3\u8981\u4ece\u5907\u4efd\u7684\u5b58\u50a8\u5e93\u4e2d\u6062\u590d\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528git clone\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git clone &lt;\u8907\u88fd\u5143\u30ea\u30dd\u30b8\u30c8\u30ea&gt;\r\n<\/code><\/pre>\n<h2>\u4e3a\u4ed3\u5e93\u8def\u5f84\u5206\u914d\u4e00\u4e2a\u540d\u79f0<\/h2>\n<p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4ed3\u5e93\u8def\u5f84\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u957f\u3002 \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4e3a\u4ed3\u5e93\u8def\u5f84\u6dfb\u52a0\u53e6\u4e00\u4e2a\u540d\u79f0\u6765\u7b80\u5316\u8f93\u5165\u8def\u5f84\u7684\u8fc7\u7a0b\u3002 \u4e3a\u4e86\u7ed9\u4ed3\u5e93\u8def\u5f84\u6dfb\u52a0\u522b\u540d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528git remote add\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git remote add &lt;\u5225\u540d&gt; &lt;\u30ea\u30dd\u30b8\u30c8\u30ea\u30d1\u30b9&gt;\r\n<\/code><\/pre>\n<p>\u5728\u522b\u540d\u4e00\u680f\u4e2d\uff0c\u4f7f\u7528&#8221;origin&#8221;\u8fd9\u4e2a\u8bcd\u662f\u4e60\u60ef\u7684\u505a\u6cd5\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528git remote -v\u547d\u4ee4\u6765\u786e\u8ba4\u5206\u914d\u7684\u540d\u79f0\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git remote -v\r\n<\/code><\/pre>\n<p>\u5c06\u522b\u540d\u66ff\u6362\u540e\uff0c\u5c06\u53d8\u66f4\u5386\u53f2\u53d1\u9001\u5230\u5907\u4efd\u5b58\u50a8\u5e93\u7684\u547d\u4ee4\u4f1a\u66f4\u52a0\u6e05\u6670\u7b80\u6d01\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git push &lt;\u9001\u4fe1\u5148\u30ea\u30dd\u30b8\u30c8\u30ea&gt; &lt;\u9001\u4fe1\u5143\u30d6\u30e9\u30f3\u30c1&gt;:&lt;\u9001\u4fe1\u5148\u30d6\u30e9\u30f3\u30c1&gt;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>$ git push origin master\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8981\u5907\u4efd\u4e3b\u5206\u652f\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\u3002<\/p>\n<p>\u5982\u679c\u4f60\u80fd\u7406\u89e3\u5230\u6b64\u5904\u7684Git\u547d\u4ee4\uff0c\u90a3\u4e48\u4f60\u5c31\u80fd\u8f7b\u677e\u7406\u89e3\u4e0a\u4f20\u5230GitHub\u65f6\u6240\u7528\u7684\u547d\u4ee4\u7684\u610f\u601d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git init\r\n$ git add README.md\r\n$ git commit -m \"first commit\"\r\n$ git branch -M main\r\n$ git remote add origin &lt;GitHub\u306e\u30ea\u30dd\u30b8\u30c8\u30eaURL&gt;\r\n$ git push -u origin main\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u662f\u5bf9\u89e3\u91ca\u7684\u8bf4\u660e\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git init\r\n$ git add README.md\r\n$ git commit -m \"first commit\"\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u5c06\u53d8\u66f4\u53cd\u6620\u5230\u6211\u7684\u672c\u5730\u73af\u5883\u7684git\u4ed3\u5e93\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git branch -M main\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u4f7f\u7528-M\u9009\u9879\u5f3a\u5236\u5c06\u5f53\u524d\u5206\u652f\u7684\u540d\u79f0\u66f4\u6539\u4e3amain\u7684\u540d\u5b57\u3002<br \/>\n\u6709\u5173\u9009\u9879\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003\u6b64\u5904\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git remote add origin &lt;GitHub\u306e\u30ea\u30dd\u30b8\u30c8\u30eaURL&gt;\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u5c06\u5907\u4efd\u4ed3\u5e93GitHub\u7684\u4ed3\u5e93URL\u7684\u4ed3\u5e93\u540d\u79f0\u66f4\u6539\u4e3a&#8221;origin&#8221;\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git push -u origin main\r\n<\/code><\/pre>\n<p>\u6700\u540e\uff0c\u5c06\u53d8\u66f4\u63a8\u9001\u5230GitHub\u4ed3\u5e93\u4ee5\u4fbf\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n<h1>\u5171\u4eab\u5b58\u5132\u5eab<\/h1>\n<p>\u8fc7\u53bb\uff0c\u6211\u4e00\u76f4\u5728\u4f7f\u7528Git\u8fdb\u884c\u4e2a\u4eba\u6587\u4ef6\u7ba1\u7406\u3002\u4f46\u5728\u5b9e\u9645\u5de5\u4f5c\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u8fdb\u884c\u56e2\u961f\u5f00\u53d1\uff0c\u591a\u4eba\u4e00\u8d77\u5f00\u53d1\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u5171\u4eab\u4ed3\u5e93\uff0c\u5171\u4eab\u6bcf\u4e2a\u4eba\u7684\u6587\u4ef6\u66f4\u6539\uff0c\u4ee5\u4fbf\u63a8\u8fdb\u5f00\u53d1\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/140-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2023-02-28 23.38.51.png\" \/><\/div>\n<p>\u5171\u6709\u5b58\u50a8\u5e93\u6307\u7684\u662f\u4e4b\u524d\u63d0\u5230\u7684\u5907\u4efd\u5b58\u50a8\u5e93\uff0c\u5907\u4efd\u5b58\u50a8\u5e93\u7684\u5b58\u50a8\u5e93\u540d\u79f0\u662f\u88ab\u5171\u4eab\u7684\u60c5\u51b5\u3002<br \/>\n\u57fa\u672c\u4e0a\uff0c\u6bcf\u4e2a\u7528\u6237\u90fd\u6709\u81ea\u5df1\u4e13\u7528\u7684\u5b58\u50a8\u5e93\uff0c\u53ef\u4ee5\u8fdb\u884c\u6587\u4ef6\u66f4\u6539\u548c\u6d4b\u8bd5\uff0c\u5f53\u5de5\u4f5c\u6709\u4e00\u5b9a\u7a0b\u5ea6\u7a33\u5b9a\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528git push\u547d\u4ee4\u5c06\u66f4\u6539\u53cd\u6620\u5230\u5171\u4eab\u5b58\u50a8\u5e93\u4e2d\u3002<\/p>\n<p>\u8981\u5c06\u5176\u4ed6\u4eba\u4fee\u6539\u7684\u5185\u5bb9\u5408\u5e76\u5230\u81ea\u5df1\u7684\u5b58\u50a8\u5e93\u4e2d\u5e76\u8fdb\u884c\u66f4\u65b0\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4f7f\u7528git fetch\u547d\u4ee4\u5c06\u5176\u4ed6\u5b58\u50a8\u5e93\u7684\u66f4\u6539\u5185\u5bb9\u5408\u5e76\u5230\u672c\u5730<\/ol>\n<\/li>\n<\/ol>\n<p>\u4f7f\u7528git merge\u547d\u4ee4\u5c06\u66f4\u6539\u5185\u5bb9\u5e94\u7528\u5230\u81ea\u5df1\u7684\u5b58\u50a8\u5e93\u4e2d<\/p>\n<h2>\u83b7\u53d6\u8fdc\u7a0b\u5e93<\/h2>\n<p>git fetch\u547d\u4ee4\u662f\u7528\u6765\u83b7\u53d6\u6307\u5b9a\u4ed3\u5e93\u7684\u66f4\u6539\u7684\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git fetch &lt;\u30ea\u30dd\u30b8\u30c8\u30ea\u540d&gt;\r\n<\/code><\/pre>\n<p>\u4fdd\u5b58\u5728\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u4e0a\u7684\u5386\u53f2\u8bb0\u5f55\u4f1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&#8221;\u8fdc\u7a0b\u540d\u79f0\/\u5206\u652f\u540d\u79f0&#8221;\u7684\u5206\u652f\uff0c\u800c\u8fd9\u4e2a\u5206\u652f\u4e0e\u7528\u6237\u81ea\u5df1\u521b\u5efa\u7684\u5206\u652f\u662f\u4e0d\u540c\u7684\u3002\u82e5\u8981\u67e5\u770b\u8fdc\u7a0b\u5206\u652f\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git branch -r\r\n<\/code><\/pre>\n<p>\u5728\u6b64\u65f6\uff0c\u5de5\u4f5c\u6811\u548c\u672c\u5730\u5206\u652f\u5c1a\u672a\u53cd\u6620\u6b64\u66f4\u6539\u3002<\/p>\n<p>\u4e3a\u4e86\u5c06\u5df2\u83b7\u5f97\u7684\u66f4\u6539\u5e94\u7528\u5230\u81ea\u5df1\u7684\u5de5\u4f5c\u6811\u6216\u5206\u652f\u4e2d\uff0c\u8bf7\u6267\u884cgit merge\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git checkout &lt;\u30de\u30fc\u30b8\u5148\u306e\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n$ git merge &lt;\u30ea\u30e2\u30fc\u30c8\u540d&gt;\/&lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<h2>\u62c9\u53d6<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4f7f\u7528git fetch\u547d\u4ee4\u5c06\u5176\u4ed6\u5b58\u50a8\u5e93\u7684\u66f4\u6539\u5185\u5bb9\u5bfc\u5165<\/ol>\n<\/li>\n<\/ol>\n<p>\u4f7f\u7528git merge\u547d\u4ee4\u5c06\u66f4\u6539\u5185\u5bb9\u5408\u5e76\u5230\u81ea\u5df1\u7684\u5b58\u50a8\u5e93\u4e2d<\/p>\n<p>\u7531\u4e8e\u5148\u524d\u6240\u63cf\u8ff0\u7684\u6b65\u9aa4\u7ecf\u5e38\u4e00\u8d77\u4f7f\u7528\uff0c\u56e0\u6b64\u5c06\u5176\u6574\u5408\u4e3a\u4e00\u4e2a\u547d\u4ee4 git pull\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git pull &lt;\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d&gt; &lt;\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u30d6\u30e9\u30f3\u30c1\u540d&gt;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u6211\u4eec\u8981\u8fdb\u884c\u6b63\u5f0f\u7684\u5171\u540c\u5f00\u53d1\uff0c\u5171\u4eab\u4ee3\u7801\u5e93\u4e0d\u5e94\u8be5\u653e\u5728\u540c\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u800c\u662f\u5e94\u8be5\u5728\u7f51\u7edc\u4e0a\u8fdb\u884c\u7ba1\u7406\u3002<br \/>\nGitHub\u662f\u4e00\u4e2a\u5728\u7ebf\u7ba1\u7406\u4ee3\u7801\u5e93\u7684\u670d\u52a1\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/157-0.png\" alt=\"image.png\" \/><\/div>\n<h1>\u8bf7\u4ee5\u4e2d\u56fd\u672c\u571f\u7684\u65b9\u5f0f\u91cd\u65b0\u8868\u8ff0\u4ee5\u4e0b\u5185\u5bb9\uff0c\u53ea\u9700\u8981\u4e00\u79cd\u505a\u6cd5:<\/h1>\n<p>\u601d\u8003<\/p>\n<p>\u300aLinux\u65b0\u624b\u6559\u7a0b\u300b\u4e09\u5b85\u82f1\u660e\u548c\u5927\u89d2\u7950\u4ecb\u5171\u540c\u8457\u4f5c\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u8fd9\u7bc7\u6587\u7ae0\u662f\u5173\u4e8e\u65b0Linux\u6559\u79d1\u4e66\u7684\u5907\u5fd8\u5f55\u3002 \u6211\u5c06\u4ee5\u5907\u5fd8\u5f55\u7684\u5f62\u5f0f\u8bb0\u5f55\u4e00\u4e9b\u7b14\u8bb0\u3002 \u8fd9\u672c\u4e66\u975e\u5e38\u6613\u61c2\uff0c\u6211\u5f3a\u70c8\u63a8\u8350 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37328","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\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\u603b\u7ed3\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git\u603b\u7ed3\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u8fd9\u7bc7\u6587\u7ae0\u662f\u5173\u4e8e\u65b0Linux\u6559\u79d1\u4e66\u7684\u5907\u5fd8\u5f55\u3002 \u6211\u5c06\u4ee5\u5907\u5fd8\u5f55\u7684\u5f62\u5f0f\u8bb0\u5f55\u4e00\u4e9b\u7b14\u8bb0\u3002 \u8fd9\u672c\u4e66\u975e\u5e38\u6613\u61c2\uff0c\u6211\u5f3a\u70c8\u63a8\u8350 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/git\u603b\u7ed3\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-22T14:01:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T18:35:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/2-0.png\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \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%e6%80%bb%e7%bb%93\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/\",\"name\":\"Git\u603b\u7ed3 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-03-22T14:01:58+00:00\",\"dateModified\":\"2024-04-29T18:35:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%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\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\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%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\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\u603b\u7ed3\/","og_locale":"zh_CN","og_type":"article","og_title":"Git\u603b\u7ed3","og_description":"\u9996\u5148 \u8fd9\u7bc7\u6587\u7ae0\u662f\u5173\u4e8e\u65b0Linux\u6559\u79d1\u4e66\u7684\u5907\u5fd8\u5f55\u3002 \u6211\u5c06\u4ee5\u5907\u5fd8\u5f55\u7684\u5f62\u5f0f\u8bb0\u5f55\u4e00\u4e9b\u7b14\u8bb0\u3002 \u8fd9\u672c\u4e66\u975e\u5e38\u6613\u61c2\uff0c\u6211\u5f3a\u70c8\u63a8\u8350 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/git\u603b\u7ed3\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-22T14:01:58+00:00","article_modified_time":"2024-04-29T18:35:58+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2da937434c4406c51ed5\/2-0.png"}],"author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/","name":"Git\u603b\u7ed3 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-03-22T14:01:58+00:00","dateModified":"2024-04-29T18:35:58+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/git%e6%80%bb%e7%bb%93\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%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\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\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%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\/37328","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\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=37328"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37328\/revisions"}],"predecessor-version":[{"id":89166,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37328\/revisions\/89166"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}