This project is read-only.

Sparse checkout

Jan 27, 2014 at 12:01 PM

I am a complete newcomer to git, but I want to use it to work on an iOS project. My company has a very large TFS repository and I would like to check out a few selected projects and resources and build them into my iOs project. I think what I need is sparse check out but I have no idea how to do this with git-TF. Could someone give me some straightforward instructions or point me to there relevant documentation? I can see how to do this with pure git but I can't see how to fit git-tf into the picture.

This is what I tried

mkdir git-tf-test-repro
cd git-tf-test-repro/
git init
Initialized empty Git repository in /Users/markdaniel/Documents/git-tf-test-repro/.git/
w183:git-tf-test-repro markdaniel$ git tf configure http://tfs:8080/tfs/DefaultCollection $/ Configuring repository git config core.sparsecheckout true

echo *project path/Acw >> .git/info/sparse-checkout
echo *some other project path/Trunk >> .git/info/sparse-checkout
echo Class\ Libraries/Utilities >> .git/info/sparse-checkout

git pull
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
git tf pull
Username: mark
Connecting to TFS...

<starts checking out the whole repository>

Where did I go wrong?

Mark Daniel
Jan 29, 2014 at 4:48 PM
Hi Mark,

Please note that according to the Git documentation: "'Sparse checkout' allows to sparsely populate working directory." I.e. you still have to maintain the full .git repository with all its objects database, just when you do checkout the working directory will contain only a subset of full set of files.

In my understanding, what do you actually wish is a "sparse clone" feature. Unfortunately it's not supported neither by Git nor by Git-TF.

I would consider few workarounds:
  1. Create multiple Git repositories (one per project) and use your IDE/Build tool capabilities to combine them into a single workspace. (E.g. Eclipse allows you to register multiple Git repositories and projects from them into a single workspace.) Unfortunately, you'll have to use a separate git tf checkin command for each Git repository (or a script with multiple commands).
  2. Clone the entire minimal TFS folder including all the projects you're interested in, define sparse checkout as needed and run git read-tree command (see git-read-tree/sparse-checkout or Subdirectory Checkouts with git sparse-checkout for example).
  3. On TFS create a folder, and then branch into it all projects of interest (one branch per project). Use the TFS folder in the git tf clone command. The local git repository will contain only the projects you need. Unfortunately, after git tf checkin you will need to merge all branches from the TFS folder one by one back to their source projects.