Although there is no direct way to “clone” just one file or folder from a Git repository using the standard git clone command, we can clone the repository and then use the git sparse checkout feature. This allows us to config on the git repository a file or directory to be checked out, and everytime we make a git pull it will only get the specified file or directory. Below are the instructions to enable that.
git clone <repository-url>git config core.sparseCheckout true.git/info/sparse-checkout with the relative path of the file/directory you want to checkoutgit fetch origin main && git checkout mainAfter you finish the last command, you will see that only the file/directory you specified on .git/info/sparse-checkout is on your local copy of the repository.