2

Is it possible to configure an existing local clone of a git repository for sparse checkout?

Existing discussion points to performing git init and git remote add -f origin <repo> which results in long download times for my situation.

I already have a repository locally and I just want to configure it for sparse checkout and then switch to a particular branch.

Thanks very much!

1 Answer 1

1

You still can use this answer: https://stackoverflow.com/a/4909267/2253302

But you should skip some steps (i.e git init and git remote add -f origin <repo>). I check this steps for my test repo:

  1. Enable sparseCheckout in your repo: git config core.sparseCheckout true
  2. Add path for sparseCheckout echo testSparseCheckout > .git/info/sparse-checkout
  3. Checkout to your desired branch

This scenario works for me well on my small testing git repo.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes - that's where I started. If "testSparseCheckout" is a folder, it won't check out all of the child files and folders inside of it. I've tried adding / and /* at the end. I does check out some child items but not all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.