Git 克隆 - 下载存储库而不保留 git

Git Clone - Download the repository without keeping git

我想将几个插件引入 WP,并制作一个脚本,仅在 NPM 脚本中从 github 获取它们。

"installplugins": "cd ../../ && 
rm -r mu-plugins && mkdir mu-plugins && 
gh repo clone repo1 mu-plugins && 
gh repo clone repo2 mu-plugins && 
gh repo clone repo3 mu-plugins && 
gh repo clone repo4 mu-plugins && 
gh repo clone repo5 mu-plugins && 
gh repo clone repo6 mu-plugins"

事情是,就在第二个 git 回购克隆中,它中断了,因为你的 mu-plugins 文件夹不再是空的。

真的,在一天结束时我只需要导出 git 存储库并将其放入文件夹中,而不保留所有 git 花里胡哨的东西,但我似乎无法找到进行回购下载而不是经典回购克隆所需的标志组合。

有人可以帮我吗?

理想情况下,您可以将它们克隆到它们自己的文件夹中。

gh repo clone repo1 mu-plugins/repo1
gh repo clone repo1 mu-plugins/repo2
gh repo clone repo1 mu-plugins/repo3

但是如果您需要 mu-plugins 中的所有 repo 文件,您将:

  • 将这些存储库克隆到单独的文件夹中
  • 转到mu-plugins(假设在其中完成git init .
  • 添加每个存储库的文件

即:

cd mu-plugins
git work-tree=../aFolder/repo1 add .
git commit -m "Import repo1 content"
...