The following approaches can be used to work with large git repositories.
-
Limit large files from being downloaded.
using ‘filter’ So files such as large binaries, zip files won’t be downloaded.
#size in MB git clone --no-checkout --filter=blob:limit=<size> your_git_repo.com
-
Limit git to a set of directories
This can be done using git ‘sparse checkout’
#inialize empty git repo mkdir your_git_dir; cd your_git_dir git init # set which sub-directory contents you want git sparse-checkout set --cone input-directory #add remote and do a pull git remote add origin my_git_repo.com git pull origin master
-
Limit the number of commits that will be cloned
git with the ‘–depth’ option can be used to limit the history to ’n’ recent commits
git clone --depth=10 your_git_repo.com