{"id":1007,"date":"2022-04-13T11:58:32","date_gmt":"2022-04-13T03:58:32","guid":{"rendered":"http:\/\/zhuxinyong.com\/?p=1007"},"modified":"2022-05-27T22:19:23","modified_gmt":"2022-05-27T14:19:23","slug":"git-bi-bei-ming-lingzi-mo-kuai","status":"publish","type":"post","link":"https:\/\/zhuxinyong.com\/?p=1007","title":{"rendered":"Git\u5fc5\u5907\u547d\u4ee4-\u5b50\u6a21\u5757"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/05\/2022-05-2722_18_45.jpeg\" alt=\"2022-05-27+22_18_45\" \/><\/p>\n<ol>\n<li>\u9996\u6b21\u62c9\u53d6\u5e26\u5b50\u4ed3\u5e93\u7684\u4ee3\u7801\u65b9\u6cd5\uff1a<\/li>\n<\/ol>\n<p>\u4ed3\u5e93\u4e00\u8d77\u62c9\u53d6\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git clone --recurse-submodules \u7236\u4ed3\u5e93\u5730\u5740\n<\/code><\/pre>\n<p>\u5206\u5f00\u62c9\u53d6\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git clone \u7236\u4ed3\u5e93\u5730\u5740\n\ngit submodule init \/\/ \u521d\u59cb\u5316\u5b50\u6a21\u5757\ngit submodule update \/\/ \u66f4\u65b0\u5b50\u6a21\u5757\u4e0e\u4e3b\u4ed3\u5e93\u4e2d\u7684\u5b50\u6a21\u5757\u4ee3\u7801\u540c\u6b65\n\/\/ or\ngit submodule update --init\n\/\/ or \u5d4c\u5957\u7684(\u5b50\u4ed3\u5e93\u4e2d\u5305\u542b\u5b50\u4ed3\u5e93)\ngit submodule update --init --recursive\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u5728\u4e3b\u4ed3\u5e93\u66f4\u6539\u5b50\u4ed3\u5e93\u4ee3\u7801\u5e76\u63d0\u4ea4\u65b9\u6cd5\uff1a<br \/>\n<img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/04\/16498226330252.jpg\" alt=\"\" \/><\/p>\n<\/li>\n<li>\n<p>\u66f4\u65b0\u3001\u62c9\u53d6\u5b50\u4ed3\u5e93\u4ee3\u7801\u65b9\u6cd5\uff1a<\/p>\n<\/li>\n<\/ol>\n<p>\u7236\u76ee\u5f55\u4e2d\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git submodule update \/\/ \u4e0e\u4e3b\u4ed3\u5e93\u4e2d\u7684\u5b50\u6a21\u5757\u4ee3\u7801\u540c\u6b65\n$ git submodule update --remote \/\/ \u4e0e\u5b50\u4ed3\u5e93\u4e2d\u4ee3\u7801\u540c\u6b65\uff08\u540c\u6b65\u6240\u6709\u7684\u5b50\u6a21\u5757\uff09\n$ git submodule update --remote xxx \/\/ \u6307\u5b9a\u9700\u8981\u540c\u6b65\u7684\u5b50\u6a21\u5757\n<\/code><\/pre>\n<p>\u5b50\u6a21\u5757\u76ee\u5f55\u4e0b\u66f4\u65b0\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git pull\n<\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u8ddf\u8e2a\u5b50\u6a21\u5757\u7684 master \u5206\u652f\uff0c\u8bbe\u7f6e\u4e3a\u5176\u4ed6\u5206\u652f\uff1a<\/p>\n<p>a.  .gitmodules \u8bbe\u7f6e<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git config -f .gitmodules submodule.[submodule-name].branch [branch-name]\n<\/code><\/pre>\n<p>\u5982\u679c\u4e0d\u7528 -f .gitmodules \u9009\u9879\uff0c\u90a3\u4e48\u5b83\u53ea\u4f1a\u4e3a\u4f60\u505a\u4fee\u6539\u3002\u4f46\u662f\u5728\u4ed3\u5e93\u4e2d\u4fdd\u7559\u8ddf\u8e2a\u4fe1\u606f\u66f4\u6709\u610f\u4e49\u4e00\u4e9b\uff0c\u56e0\u4e3a\u5176\u4ed6\u4eba\u4e5f\u53ef\u4ee5\u5f97\u5230\u540c\u6837\u7684\u6548\u679c\u3002<\/p>\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_44070450\/article\/details\/107701812\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/weixin_44070450\/article\/details\/107701812<\/a><\/p>\n<p><a href=\"https:\/\/git-scm.com\/book\/zh\/v2\/Git-%E5%B7%A5%E5%85%B7-%E5%AD%90%E6%A8%A1%E5%9D%97\" target=\"_blank\" rel=\"noopener\">https:\/\/git-scm.com\/book\/zh\/v2\/Git-%E5%B7%A5%E5%85%B7-%E5%AD%90%E6%A8%A1%E5%9D%97<\/a><\/p>\n<ol start=\"4\">\n<li>\u5220\u9664submodule<br \/>\n4.1 \u5220\u9664 .gitmodules \u6587\u4ef6\u4e2d\u76f8\u5173\u7684\u5185\u5bb9<\/li>\n<\/ol>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">-[submodule &quot;editorjs&quot;]\n-        path = editorjs\n-        url = https:\/\/github.com\/codex-team\/editor.js\n<\/code><\/pre>\n<p>4.2 \u5220\u9664.git\/config \u6587\u4ef6\u4e2d\u76f8\u5173\u5185\u5bb9<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n        ignorecase = true\n        precomposeunicode = true\n[remote &quot;origin&quot;]\n        url = https:\/\/github.com\/talyguryn\/test\n        fetch = +refs\/heads\/*:refs\/remotes\/origin\/*\n[branch &quot;master&quot;]\n        remote = origin\n        merge = refs\/heads\/master\n-[submodule &quot;editorjs&quot;]\n-        active = true\n-        url = https:\/\/github.com\/codex-team\/editor.js\n<\/code><\/pre>\n<p>4.3 \u5220\u9664\u7f13\u5b58<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git rm --cached path_to_submodule (no trailing slash)\n<\/code><\/pre>\n<p>4.4 \u5220\u9664 .git\/modules\u4e0b\u9762\u76ee\u5f55<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">rm -rf .git\/modules\/path_to_submodule (no trailing slash)\n<\/code><\/pre>\n<p>4.5 \u5220\u9664 \u5b50\u76ee\u5f55<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">rm -rf path_to_submodule\n<\/code><\/pre>\n<p>4.6 \u63d0\u4ea4\u66f4\u6539<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">git commit -am &quot;Remove submodule&quot;\n<\/code><\/pre>\n<p>\u89e3\u51b3\u7684\u95ee\u9898\uff1a<br \/>\n\u6709\u79cd\u60c5\u51b5\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\uff1a\u67d0\u4e2a\u5de5\u4f5c\u4e2d\u7684\u9879\u76ee\u9700\u8981\u5305\u542b\u5e76\u4f7f\u7528\u53e6\u4e00\u4e2a\u9879\u76ee\u3002 \u4e5f\u8bb8\u662f\u7b2c\u4e09\u65b9\u5e93\uff0c\u6216\u8005\u4f60\u72ec\u7acb\u5f00\u53d1\u7684\uff0c\u7528\u4e8e\u591a\u4e2a\u7236\u9879\u76ee\u7684\u5e93\u3002 \u73b0\u5728\u95ee\u9898\u6765\u4e86\uff1a\u4f60\u60f3\u8981\u628a\u5b83\u4eec\u5f53\u505a\u4e24\u4e2a\u72ec\u7acb\u7684\u9879\u76ee\uff0c\u540c\u65f6\u53c8\u60f3\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\u4f7f\u7528\u53e6\u4e00\u4e2a\u3002<\/p>\n<p>\u5f00\u59cb\u4f7f\u7528\u5b50\u6a21\u5757<br \/>\n\u6211\u4eec\u9996\u5148\u5c06\u4e00\u4e2a\u5df2\u5b58\u5728\u7684 Git \u4ed3\u5e93\u6dfb\u52a0\u4e3a\u6b63\u5728\u5de5\u4f5c\u7684\u4ed3\u5e93\u7684\u5b50\u6a21\u5757\u3002 \u4f60\u53ef\u4ee5\u901a\u8fc7\u5728 git submodule add \u547d\u4ee4\u540e\u9762\u52a0\u4e0a\u60f3\u8981\u8ddf\u8e2a\u7684\u9879\u76ee\u7684\u76f8\u5bf9\u6216\u7edd\u5bf9 URL \u6765\u6dfb\u52a0\u65b0\u7684\u5b50\u6a21\u5757\u3002 \u5728\u672c\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f1a\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3a \u201cDbConnector\u201d \u7684\u5e93\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git submodule add https:\/\/github.com\/chaconinc\/DbConnector\nCloning into 'DbConnector'...\nremote: Counting objects: 11, done.\nremote: Compressing objects: 100% (10\/10), done.\nremote: Total 11 (delta 0), reused 11 (delta 0)\nUnpacking objects: 100% (11\/11), done.\nChecking connectivity... done.\n<\/code><\/pre>\n<p>\u514b\u9686\u542b\u6709\u5b50\u6a21\u5757\u7684\u9879\u76ee<br \/>\n\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u4f1a\u514b\u9686\u4e00\u4e2a\u542b\u6709\u5b50\u6a21\u5757\u7684\u9879\u76ee\u3002 \u5f53\u4f60\u5728\u514b\u9686\u8fd9\u6837\u7684\u9879\u76ee\u65f6\uff0c\u9ed8\u8ba4\u4f1a\u5305\u542b\u8be5\u5b50\u6a21\u5757\u76ee\u5f55\uff0c\u4f46\u5176\u4e2d\u8fd8\u6ca1\u6709\u4efb\u4f55\u6587\u4ef6\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git clone https:\/\/github.com\/chaconinc\/MainProject\nCloning into 'MainProject'...\nremote: Counting objects: 14, done.\nremote: Compressing objects: 100% (13\/13), done.\nremote: Total 14 (delta 1), reused 13 (delta 0)\nUnpacking objects: 100% (14\/14), done.\nChecking connectivity... done.\n$ cd MainProject\n$ ls -la\ntotal 16\ndrwxr-xr-x   9 schacon  staff  306 Sep 17 15:21 .\ndrwxr-xr-x   7 schacon  staff  238 Sep 17 15:21 ..\ndrwxr-xr-x  13 schacon  staff  442 Sep 17 15:21 .git\n-rw-r--r--   1 schacon  staff   92 Sep 17 15:21 .gitmodules\ndrwxr-xr-x   2 schacon  staff   68 Sep 17 15:21 DbConnector\n-rw-r--r--   1 schacon  staff  756 Sep 17 15:21 Makefile\ndrwxr-xr-x   3 schacon  staff  102 Sep 17 15:21 includes\ndrwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 scripts\ndrwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 src\n$ cd DbConnector\/\n$ ls\n$\n<\/code><\/pre>\n<p>\u5176\u4e2d\u6709 DbConnector \u76ee\u5f55\uff0c\u4e0d\u8fc7\u662f\u7a7a\u7684\u3002 \u4f60\u5fc5\u987b\u8fd0\u884c\u4e24\u4e2a\u547d\u4ee4\uff1agit submodule init \u7528\u6765\u521d\u59cb\u5316\u672c\u5730\u914d\u7f6e\u6587\u4ef6\uff0c\u800c git submodule update \u5219\u4ece\u8be5\u9879\u76ee\u4e2d\u6293\u53d6\u6240\u6709\u6570\u636e\u5e76\u68c0\u51fa\u7236\u9879\u76ee\u4e2d\u5217\u51fa\u7684\u5408\u9002\u7684\u63d0\u4ea4\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git submodule init\nSubmodule 'DbConnector' (https:\/\/github.com\/chaconinc\/DbConnector) registered for path 'DbConnector'\n$ git submodule update\nCloning into 'DbConnector'...\nremote: Counting objects: 11, done.\nremote: Compressing objects: 100% (10\/10), done.\nremote: Total 11 (delta 0), reused 11 (delta 0)\nUnpacking objects: 100% (11\/11), done.\nChecking connectivity... done.\nSubmodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'\n<\/code><\/pre>\n<p>\u4e0d\u8fc7\u8fd8\u6709\u66f4\u7b80\u5355\u4e00\u70b9\u7684\u65b9\u5f0f\u3002 \u5982\u679c\u7ed9 git clone \u547d\u4ee4\u4f20\u9012 &#8211;recurse-submodules \u9009\u9879\uff0c\u5b83\u5c31\u4f1a\u81ea\u52a8\u521d\u59cb\u5316\u5e76\u66f4\u65b0\u4ed3\u5e93\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5b50\u6a21\u5757\uff0c \u5305\u62ec\u53ef\u80fd\u5b58\u5728\u7684\u5d4c\u5957\u5b50\u6a21\u5757\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git clone --recurse-submodules https:\/\/github.com\/chaconinc\/MainProject\nCloning into 'MainProject'...\nremote: Counting objects: 14, done.\nremote: Compressing objects: 100% (13\/13), done.\nremote: Total 14 (delta 1), reused 13 (delta 0)\nUnpacking objects: 100% (14\/14), done.\nChecking connectivity... done.\nSubmodule 'DbConnector' (https:\/\/github.com\/chaconinc\/DbConnector) registered for path 'DbConnector'\nCloning into 'DbConnector'...\nremote: Counting objects: 11, done.\nremote: Compressing objects: 100% (10\/10), done.\nremote: Total 11 (delta 0), reused 11 (delta 0)\nUnpacking objects: 100% (11\/11), done.\nChecking connectivity... done.\nSubmodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u514b\u9686\u4e86\u9879\u76ee\u4f46\u5fd8\u8bb0\u4e86 &#8211;recurse-submodules\uff0c\u90a3\u4e48\u53ef\u4ee5\u8fd0\u884c git submodule update &#8211;init \u5c06 git submodule init \u548c git submodule update \u5408\u5e76\u6210\u4e00\u6b65\u3002\u5982\u679c\u8fd8\u8981\u521d\u59cb\u5316\u3001\u6293\u53d6\u5e76\u68c0\u51fa\u4efb\u4f55\u5d4c\u5957\u7684\u5b50\u6a21\u5757\uff0c \u8bf7\u4f7f\u7528\u7b80\u660e\u7684 git submodule update &#8211;init &#8211;recursive\u3002<\/p>\n<p>\u5728\u5305\u542b\u5b50\u6a21\u5757\u7684\u9879\u76ee\u4e0a\u5de5\u4f5c<\/p>\n<p>\u4ece\u5b50\u6a21\u5757\u7684\u8fdc\u7aef\u62c9\u53d6\u4e0a\u6e38\u4fee\u6539<br \/>\n\u5982\u679c\u60f3\u8981\u5728\u5b50\u6a21\u5757\u4e2d\u67e5\u770b\u65b0\u5de5\u4f5c\uff0c\u53ef\u4ee5\u8fdb\u5165\u5230\u76ee\u5f55\u4e2d\u8fd0\u884c git fetch \u4e0e git merge\uff0c\u5408\u5e76\u4e0a\u6e38\u5206\u652f\u6765\u66f4\u65b0\u672c\u5730\u4ee3\u7801\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git fetch\nFrom https:\/\/github.com\/chaconinc\/DbConnector\n   c3f01dc..d0354fc  master     -&gt; origin\/master\n$ git merge origin\/master\nUpdating c3f01dc..d0354fc\nFast-forward\n scripts\/connect.sh | 1 +\n src\/db.c           | 1 +\n 2 files changed, 2 insertions(+)\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u4e0d\u60f3\u5728\u5b50\u76ee\u5f55\u4e2d\u624b\u52a8\u6293\u53d6\u4e0e\u5408\u5e76\uff0c\u90a3\u4e48\u8fd8\u6709\u79cd\u66f4\u5bb9\u6613\u7684\u65b9\u5f0f\u3002 \u8fd0\u884c git submodule update &#8211;remote\uff0cGit \u5c06\u4f1a\u8fdb\u5165\u5b50\u6a21\u5757\u7136\u540e\u6293\u53d6\u5e76\u66f4\u65b0\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git submodule update --remote DbConnector\nremote: Counting objects: 4, done.\nremote: Compressing objects: 100% (2\/2), done.\nremote: Total 4 (delta 2), reused 4 (delta 2)\nUnpacking objects: 100% (4\/4), done.\nFrom https:\/\/github.com\/chaconinc\/DbConnector\n   3f19983..d0354fc  master     -&gt; origin\/master\nSubmodule path 'DbConnector': checked out 'd0354fc054692d3906c85c3af05ddce39a1c0644'\n<\/code><\/pre>\n<p>\u6b64\u547d\u4ee4\u9ed8\u8ba4\u4f1a\u5047\u5b9a\u4f60\u60f3\u8981\u66f4\u65b0\u5e76\u68c0\u51fa\u5b50\u6a21\u5757\u4ed3\u5e93\u7684 master \u5206\u652f\u3002 \u4e0d\u8fc7\u4f60\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u60f3\u8981\u7684\u5176\u4ed6\u5206\u652f\u3002 \u4f8b\u5982\uff0c\u4f60\u60f3\u8981 DbConnector \u5b50\u6a21\u5757\u8ddf\u8e2a\u4ed3\u5e93\u7684 \u201cstable\u201d \u5206\u652f\uff0c\u90a3\u4e48\u65e2\u53ef\u4ee5\u5728 .gitmodules \u6587\u4ef6\u4e2d\u8bbe\u7f6e \uff08\u8fd9\u6837\u5176\u4ed6\u4eba\u4e5f\u53ef\u4ee5\u8ddf\u8e2a\u5b83\uff09\uff0c\u4e5f\u53ef\u4ee5\u53ea\u5728\u672c\u5730\u7684 .git\/config \u6587\u4ef6\u4e2d\u8bbe\u7f6e\u3002 \u8ba9\u6211\u4eec\u5728 .gitmodules \u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git config -f .gitmodules submodule.DbConnector.branch stable\n\n$ git submodule update --remote\nremote: Counting objects: 4, done.\nremote: Compressing objects: 100% (2\/2), done.\nremote: Total 4 (delta 2), reused 4 (delta 2)\nUnpacking objects: 100% (4\/4), done.\nFrom https:\/\/github.com\/chaconinc\/DbConnector\n   27cf5d3..c87d55d  stable -&gt; origin\/stable\nSubmodule path 'DbConnector': checked out 'c87d55d4c6d4b05ee34fbc8cb6f7bf4585ae6687'\n<\/code><\/pre>\n<p>\u5982\u679c\u4e0d\u7528 -f .gitmodules \u9009\u9879\uff0c\u90a3\u4e48\u5b83\u53ea\u4f1a\u4e3a\u4f60\u505a\u4fee\u6539\u3002\u4f46\u662f\u5728\u4ed3\u5e93\u4e2d\u4fdd\u7559\u8ddf\u8e2a\u4fe1\u606f\u66f4\u6709\u610f\u4e49\u4e00\u4e9b\uff0c\u56e0\u4e3a\u5176\u4ed6\u4eba\u4e5f\u53ef\u4ee5\u5f97\u5230\u540c\u6837\u7684\u6548\u679c\u3002<br \/>\n\u8fd9\u65f6\u6211\u4eec\u8fd0\u884c git status\uff0cGit \u4f1a\u663e\u793a\u5b50\u6a21\u5757\u4e2d\u6709\u201c\u65b0\u63d0\u4ea4\u201d\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git status\nOn branch master\nYour branch is up-to-date with 'origin\/master'.\n\nChanges not staged for commit:\n  (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)\n  (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)\n\n  modified:   .gitmodules\n  modified:   DbConnector (new commits)\n\nno changes added to commit (use &quot;git add&quot; and\/or &quot;git commit -a&quot;)\n<\/code><\/pre>\n<p>\u4ece\u9879\u76ee\u8fdc\u7aef\u62c9\u53d6\u4e0a\u6e38\u66f4\u6539<br \/>\n\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u7ad9\u5728\u534f\u4f5c\u8005\u7684\u89c6\u89d2\uff0c\u4ed6\u6709\u81ea\u5df1\u7684 MainProject \u4ed3\u5e93\u7684\u672c\u5730\u514b\u9686\uff0c \u53ea\u662f\u6267\u884c git pull \u83b7\u53d6\u4f60\u65b0\u63d0\u4ea4\u7684\u66f4\u6539\u8fd8\u4e0d\u591f\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git pull\nFrom https:\/\/github.com\/chaconinc\/MainProject\n   fb9093c..0a24cfc  master     -&gt; origin\/master\nFetching submodule DbConnector\nFrom https:\/\/github.com\/chaconinc\/DbConnector\n   c3f01dc..c87d55d  stable     -&gt; origin\/stable\nUpdating fb9093c..0a24cfc\nFast-forward\n .gitmodules         | 2 +-\n DbConnector         | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\n$ git status\n On branch master\nYour branch is up-to-date with 'origin\/master'.\nChanges not staged for commit:\n  (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)\n  (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)\n\n\tmodified:   DbConnector (new commits)\n\nSubmodules changed but not updated:\n\n* DbConnector c87d55d...c3f01dc (4):\n  &lt; catch non-null terminated lines\n  &lt; more robust error handling\n  &lt; more efficient db routine\n  &lt; better connection routine\n\nno changes added to commit (use &quot;git add&quot; and\/or &quot;git commit -a&quot;)\n<\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cgit pull \u547d\u4ee4\u4f1a\u9012\u5f52\u5730\u6293\u53d6\u5b50\u6a21\u5757\u7684\u66f4\u6539\uff0c\u5982\u4e0a\u9762\u7b2c\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u6240\u793a\u3002 \u7136\u800c\uff0c\u5b83\u4e0d\u4f1a \u66f4\u65b0 \u5b50\u6a21\u5757\u3002\u8fd9\u70b9\u53ef\u901a\u8fc7 git status \u547d\u4ee4\u770b\u5230\uff0c\u5b83\u4f1a\u663e\u793a\u5b50\u6a21\u5757\u201c\u5df2\u4fee\u6539\u201d\uff0c\u4e14\u201c\u6709\u65b0\u7684\u63d0\u4ea4\u201d\u3002 \u6b64\u5916\uff0c\u5de6\u8fb9\u7684\u5c16\u62ec\u53f7\uff08&lt;\uff09\u6307\u51fa\u4e86\u65b0\u7684\u63d0\u4ea4\uff0c\u8868\u793a\u8fd9\u4e9b\u63d0\u4ea4\u5df2\u5728 MainProject \u4e2d\u8bb0\u5f55\uff0c\u4f46\u5c1a\u672a\u5728\u672c\u5730\u7684 DbConnector \u4e2d\u68c0\u51fa\u3002 \u4e3a\u4e86\u5b8c\u6210\u66f4\u65b0\uff0c\u4f60\u9700\u8981\u8fd0\u884c git submodule update\uff1a<\/p>\n<pre class=\"line-numbers\"><code class=\"language-plain_text\">$ git submodule update --init --recursive\nSubmodule path 'vendor\/plugins\/demo': checked out '48679c6302815f6c76f1fe30625d795d9e55fc56'\n\n$ git status\n On branch master\nYour branch is up-to-date with 'origin\/master'.\nnothing to commit, working tree clean\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u6b21\u62c9\u53d6\u5e26\u5b50\u4ed3\u5e93\u7684\u4ee3\u7801\u65b9\u6cd5\uff1a \u4ed3\u5e93\u4e00\u8d77\u62c9\u53d6\uff1a git clone &#8211;recurse-submodu&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,27,3],"tags":[28],"class_list":["post-1007","post","type-post","status-publish","format-standard","hentry","category-all","category-tool","category-tech","tag-git"],"_links":{"self":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1007"}],"version-history":[{"count":3,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1007\/revisions"}],"predecessor-version":[{"id":1220,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1007\/revisions\/1220"}],"wp:attachment":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}