I have a two branches main and feature branch. In both the branches there are two folders f1 and f2. There is a file inside f1 folder called file1.txt.
main branch structure
-root
- f1
- file1.txt
- f2
feature branch structure
-root
- f1
- file1.txt
- f2
I want to clone f1 folder and its content using sparse checkout and after that I want to switch branches. How can i do that?
What I have tried:
git clone <link to repo> --depth 1 --filter=blob:none --sparse
cd <folder name>
git sparse-checkout set f1/
git fetch --all
git branch -a
git checkout feature
doing this i get this error "error: pathspec 'feature' did not match any file(s) known to git"
can someone guide me here?