|home| |posts| |projects| |cv| |bookmarks| |github|

Git Sparse Checkout

Resources

Howto

Clone(no checkout + partial clone), full clone can also be done but will download everything:

git clone --no-checkout --filter:blob:none https://git.foo.bar/baz

Init sparse checkout:

git sparse-checkout init --cone

Checkout wanted branch:

git checkout main

Set wanted dirs:

git sparse-checkout set my_dir

Now do your work as usual(git fetch/pull/status/add/commit/push/etc.).

If you need another directory, use set/add:

git sparse-checkout add my_dir

If you want to go back to regular mode, disable sparse checkout(will do a full checkout):

git sparse-checkout disable