问题描述
是否可以在Git中检查存储库的子目录?
想象一下,我正在设置一个新的WordPress安装。我将为我的插件和主题定制创建两个新目录:
wordpress / wp-content / plugins / myplugins / b $ li
$ / $>
我想通过Git维护这些目录。在Subversion中,我可以通过使用 trunk / myplugins /
和 trunk / mytheme /
目录并检出子目录来实现此目的。 Git是否有办法使用单个存储库完成相同的任务?
我可能会错过某些Git范例,因为很长一段时间SVN用户很少暴露给Git。
编辑: 存储不同的内容是一个有趣的方式来处理这个问题。
为。
另请参阅问题。
请注意,稀疏检出仍然需要您下载整个回购即使Git下载的某些文件不会在您的工作树中结束。
Is it possible to check out subdirectories of a repository in Git?
Imagine I am setting up a new WordPress installation. I will create two new directories for my plugin and theme customization:
wordpress/wp-content/plugins/myplugins/
wordpress/wp-content/themes/mytheme/
I want to maintain these directories via Git. In Subversion, I would accomplish this by having trunk/myplugins/
and trunk/mytheme/
directories and checking out subdirectories. Does Git have a way to accomplish the same task using a single repository?
I could just be missing the boat on some Git paradigm, as a long time SVN user with little exposure to Git.
Edit: Multiple branches storing different content is an interesting way to handle this.
Sparse checkouts are now in Git 1.7.
Also see the question "Is it possible to do a sparse checkout without checking out the whole repository first?".
Note that sparse checkouts still require you to download the whole repository, even though some of the files Git downloads won't end up in your working tree.
这篇关于在Git中签出子目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!