git - 在 Git 中检查子目录?

标签 git sparse-checkout

是否可以在 Git 中 check out 存储库的子目录?

假设我正在设置一个新的 WordPress 安装。我将为我的插件和主题自定义创建两个新目录:

  • wordpress/wp-content/plugins/myplugins/
  • wordpress/wp-content/themes/mytheme/

我想通过 Git 维护这些目录。在 Subversion 中,我将通过拥有 trunk/myplugins/trunk/mytheme/ 目录并 check out 子目录来完成此操作。 Git 是否有办法使用单个存储库完成相同的任务?

作为一个很少接触 Git 的 SVN 长期用户,我可能只是错过了一些 Git 范例。

编辑: Multiple branches存储不同的内容是一种有趣的处理方式。

最佳答案

Sparse checkoutsnow in Git 1.7 .

另见问题“Is it possible to do a sparse checkout without checking out the whole repository first? ”。

请注意,稀疏 checkout 仍然需要您下载整个存储库,即使 Git 下载的某些文件最终不会出现在您的工作树中。

关于git - 在 Git 中检查子目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/180052/

相关文章:

svn - 深层目录结构的稀疏 svn 更新

windows - 为什么 git sparse checkout 会留下目录?

git - 如何让 git 在编辑 sparse-checkout 后下载一个新文件夹?

Git sparse checkout 只支持 repo 根目录下的文件夹?

git - git Remote 是如何工作的?

git - 你如何删除一个 git 标签并通过 git pull 将所述删除传播给其他人?

windows - 为什么我无法将代码提交到 GitHub?

c# - 无法加载 DLL 'git2.dll' 找不到指定的模块

git - 为什么在 git diff 或 git status 之后触摸文件的 git diff-index HEAD 结果会发生变化?

Git 从存储库中提取文件夹的内容