Skip to content

Working with Selected Components

Working with Selected Components - Sparse Checkout

In some instance you may find that its not possible to checkout the entire customer solution repository due to network or disk limitations or simply you wish only to have certain set of components.

GIT has built in capability to do such selected checkout which is called 'git sparse checkout.'

Below example shows how to do a git spare checkout only containing two components. Git Bash is used for illustration purposes.

  • Create a folder for the repository
mkdir <project>_repo
cd <project>_repo  

  • Initialize repository.
git init ()
  • Enable sparse checkout.
git config core.sparsecheckout true
  • Checkout a single component
echo accrul >> .git/info/sparse-checkout
  • If multiple components are needed, it will be easier to directly modify <project>_repo/.git/info/sparse-checkout file.
  • Add each component name line by line.
  • Add remote url for the customer solution repo
git remote add -f origin <customer solution repo url>
  • Fetch the files - only the components you specified will be pulled
git pull origin master ()