Borrowing from a few tutorials, I am able to do a sparse checkout of a particular folder in a git repo.
mkdir git-completion && cd git-completion
git init
git remote add –f origin https://github.com/git/git.git
git config core.sparsecheckout true
echo contrib/completion/ >> .git/info/sparse-checkout
git pull origin master
For example, let's say that I am after the git-completion.bash, git-completion.tcsh, etc scripts that are in the contrib/completion folder of this repo.
The above sparse-checkout does return me the desired folder, but it seems to have a nested file strucure:
git-completion/contrib/completion/git-completion.bash
Is it possible to pull the files instead into the parent directory like so?
git-completion/git-completion.bash