DEV Community

Jasterix
Jasterix

Posted on

Exploring git sparse checkout

get the remote url:
git config --get remote.origin.url

remove the remote url:
git remote remove origin

enable sparse checkout:
git config core.sparsecheckout true

add the remote:
git remote add -f origin https://github.com/git/git.git

select the directories you want to checkout:
echo /wiki/tools/ >> .git/info/sparse-checkout

pull from the remote:
git pull origin master

resources
using git sparse checkout: https://briancoyner.github.io/articles/2013-06-05-git-sparse-checkout/#:~:text=Using%20Git%20Sparse%20Checkout%201%20Create%20a%20directory.,You%20should%20now%20have%20the%20contrib%2Fcompletion%20directory.%20

git docs on sparse checkout:
https://www.git-scm.com/docs/git-sparse-checkout#_full_pattern_set

getting your remotes: https://www.digitalocean.com/community/questions/how-to-check-the-remote-origin-url-of-a-local-git-repository

Top comments (0)