Let’s say I have a repository MyRepo with this structure:
MyRepo/subDirLevel1/subDirLevel2/someFile
I’m only interested in subDirLevel2. I know with sparse checkout I could do e.g. this:
git clone --filter=blob:none --no-checkout --depth 1 --sparse link/to/MyRepo.git
cd MyRepo
git sparse-checkout add subDirLevel1/subDirLevel2
git checkout
which would check out only the subDirLevel2‘s contents without any other stuff that might possibly be in subDirLevel1 or MyRepo.
But I would like to "skip" the subDirLevel1 dir altogether so that after the checkout I would end up with either:
C:\projects\MyRepo\subDirLevel2
or possibly:
C:\projects\subDirLevel2
with it still being a repo I can run commands (e.g. git status) on.
Is this possible? (I don’t need to be able to commit to that repo, if that changes anything, just git pull to keep it up-to-date.)
>Solution :
No, and I doubt it will ever be implemented. Sparse checkout is implemented using "skip worktree" flags for not checked out paths but paths in the working tree must correspond to trees in commits/index.