根据 this thread , Git 中的排除 sparse-checkout
feature应该实现。是吗?
假设我有以下结构:
papers/
papers/...
presentations/
presentations/heavy_presentation
presentations/...
现在我想从 checkout 中排除 presentations/heavy_presentation
,而将其余部分留在 checkout 中。我还没有设法让它运行。正确的语法是什么?
最佳答案
遗憾的是,以上都不适合我,所以我花了很长时间尝试 sparse-checkout
文件的不同组合。
在我的例子中,我想跳过带有 IntelliJ IDEA 配置的文件夹。
这是我做的:
运行 git clone https://github.com/myaccount/myrepo.git --no-checkout
运行 git config core.sparsecheckout true
使用以下内容创建了 .git\info\sparse-checkout
!.idea/*
!.idea_modules/*
/*
运行“git checkout --”获取所有文件。
让它工作的关键是在文件夹名称后添加 /*
。
我有 git 1.9
关于带有排除的 Git 稀疏 checkout ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9572407/