maphew

Git Sparse Checkout

January 5, 2022 

Example scenario 

This is a Git "sparse checkout" or single folder of the larger ENV-GIS-COE project. (Replace Matt's name with yours of course.) 

With Git Extensions:

  1. Clone the master ENV-GIS-COE repo, don't download full history (optional)
  2. Repository >> Sparse Working Copy >> add env-gis-dev as only folder
  3. Select most recent commit in this folder: r-click >> Reset >> Hard 

Or from command line:

git init 
git sparse-checkout init 
git sparse-checkout add !/* 
git sparse-checkout add env-gis-dev 
git remote add origin http://Matt.Wilkie@app-cms-git01.gov.yk.ca/env-devops/geo/ENV-GIS-COE.git 
git pull --depth=10 origin master