How can we clone a path only of a git repository?
How can we clone a path only of a git repository?
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
Rony cortze
You will end up downloading the entire history, so I don’t see much benefit in it, but you can checkout specific parts using a “sparse” checkout.
The steps to do a sparse clone are as follows:
This creates an empty repository with your remote, and fetches all objects but doesn’t check them out. Then do:
Now you need to define which files/folders you want to actually check out. This is done by listing them in
.git/info/sparse-checkout
, eg:Last but not least, update your empty repo with the state from the remote:
You might be better off using a shallow clone too. Instead of the
git pull
command given earlier, try: