git - 从 GitHub 存储库中检出文件夹的内容,而不是使用 sparse-checkout 检出文件夹本身
问题描述
我在 GitHub 上创建了一个存储库,其中包含我的一个小项目的文件。这个存储库的内容都来自不同的位置,因此我不想查看整个存储库,而只想查看一个子目录。
经过一番调查,我发现有稀疏结帐功能,它应该完全符合我的要求。我发现的所有教程的问题是,我只能签出子目录,而不是子目录的内容。
示例:我的存储库有“/patches/”,其中包含一些文件。我的本地 PC 也有一个文件夹“C:\wherever\patches”。在这个文件夹中,我想查看补丁的内容,但每次它都会在我的补丁文件夹中查看一个文件夹补丁。
目标具有以下结构:
C:\wherever\patches\
C:\wherever\patches\.git\
(the .git folder should be inside the patches, not outside next to it -
i want to check out the contents, not the folder)
C:\wherever\patches\<rest of the content>
到目前为止我尝试了什么:在我的本地“补丁”文件夹中运行 Git Bash:
git init
git sparse-checkout init
git sparse-checkout set patches/
git remote add -f origin https://github.com/BlackMagicCoding/PokemonRubySapphire.git
git pull origin main
为“git sparse-checkout set”命令尝试了不同的值,但对我没有任何作用。
解决方案
推荐阅读
- javascript - 如何获取元素的计算样式更改
- azure - 带有 Azure Web 应用和 API 的容器
- python - 测量pySpark中两列之间的MSE
- yii2 - CKEDITOR.ENTER_BR 选项在 Yii2 中不起作用
- javascript - XSS:img 标记中单独的 src 属性是否会导致 XSS?
- sql - 错误:关系“foo”不存在
- spring-boot - HTTPS 安全仅适用于主页而不是下一页
- r - Worldmap 包错误,grid.Call.graphics 中的错误(C_polygon,x$x,x$y,index):无效颜色名称“blackcat”
- php - magento2 bin/magento 不工作
- android - react-native-navigation 如何关闭应用通知