Skip to content

Instantly share code, notes, and snippets.

@smac89
Created May 16, 2021 05:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smac89/3d1e3cb1f1b425fa9a400c61c51cff24 to your computer and use it in GitHub Desktop.
Save smac89/3d1e3cb1f1b425fa9a400c61c51cff24 to your computer and use it in GitHub Desktop.
Git sparse checkout a folder from specific branch

The goal

Checkout the llvm folder from the release/11.x branch in https://github.com/llvm/llvm-project

My process

git init llvm-project
cd llvm-project
git remote add origin https://github.com/llvm/llvm-project
git fetch --depth=1
git config core.sparseCheckout true
echo llvm >> .git/info/sparse-checkout
git checkout release/11.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment