This isn't really ground breaking and it’s not often used. I can imagine this scenario when having a bigger project where two components live together (like a webapp that has the API and the Javascript App in the same repository) and you want to checkout just one of them. Of course the best solution for this might be to use a submodule, but in this case you may have not looked for this approach anyway.
So what is required? Start by defining a new directory and inside that directory initialize an empty repository. After that activate the sparse checkout mode for the repository, add the remote of the repository and configure the folders required for checkout into sparse mode. From here on you can checkout the different brunches and get only the directories or file marked for checkout.
Here are the console commands explained above:
mkdir repo -dir
cd repo -dir
git init
git config core.sparseCheckout true
git remote add -f origin git://repo-location
echo "required_subdir/*" > .git/info/sparse-checkout
git checkout [branchname]
git pull