Alex M
Alex M

Reputation: 720

configuring existing git repo for sparse checkout

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!

Upvotes: 2

Views: 1794

Answers (1)

alexander.polomodov
alexander.polomodov

Reputation: 5534

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.

Upvotes: 1

Related Questions