0

How can I setup my git project to only clone/checkout certain directories.

In my project I have the following directories

/dira
/dirb
/dirc

In some cases I would only like to checkout dira, in some cases I would only like to checkout dirb, and in some cases I would only like to checkout dirc. There are also times I would want to checkout all 3 directories.

1 Answers1

2

Its pretty simple but you cant configure git to do automatically:

# Checkout any desired file or path
git checkout <commit id> -- /path/to/dir

Note

The 2 -- at the end are important and cannot be left off.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167