My Requirement was to checkout a specific directory from a repo and also checkout each branch which has that directory and copy each branch directory to a target path.
For Example football is a repo and src/ronaldo is the directory which I am trying to checkout and football repo has Branch A,B,C,D. But src/ronaldo is only in branch A and B. Now I wanna checkout the directory from Branch A and B and copy it to target folder Messi.
I tried to do a sparse checkout a specific directory in a repo and I am able to do it using the below commands.
git clone --filter=blob:none --no-checkout --depth 1 --sparse <project-url>
cd <project>
Specify the folders you want to clone
git sparse-checkout add <folder1> <folder2>
git checkout
But I am not able to find the rest of the branch which has the directory. What other git commands need to be added here.