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!

Community
  • 1
  • 1
Alex M
  • 690
  • 4
  • 18

1 Answers1

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.

Community
  • 1
  • 1
alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46
  • 1
    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. – Alex M Apr 02 '16 at 16:20