git-sprig
v1.0.0
Published
Clone a single folder from a GitHub repository using a permalink
Downloads
113
Maintainers
Readme
git-sprig 🌿
Clone a single folder from a GitHub repository — without downloading the whole thing.
https://github.com/{owner}/{repo}/tree/{branch-or-commit}/{path/to/folder}Why?
Without git-sprig, getting just one folder out of a repository looks like this:
# 1. Clone the entire repository (can be hundreds of MB)
git clone https://github.com/anthropics/anthropic-cookbook.git
# 2. Copy the folder you actually wanted
cp -r anthropic-cookbook/skills ./skills
# 3. Delete the rest
rm -rf anthropic-cookbookWith git-sprig:
git sprig https://github.com/anthropics/anthropic-cookbook/tree/main/skills
# Done. Only the 'skills' folder is in your current directory.Install
npm install -g git-sprigRequires Node.js ≥ 14 and Git ≥ 2.25.
Usage
git sprig <github-permalink>Paste any GitHub URL that points to a folder (the kind you get when browsing a repo's subdirectory):
https://github.com/{owner}/{repo}/tree/{branch-or-commit}/{path/to/folder}The folder will be downloaded into the current directory. That's it.
Example
# Downloads the 'skills' folder into ./skills
git sprig https://github.com/anthropics/anthropic-cookbook/tree/main/skillsHow it works
No GitHub API. No ZIP downloads. Just efficient Git:
- Parses the permalink to extract the repo URL, ref, and folder path
- Initialises a temporary local repo with
git sparse-checkout - Fetches only the target folder with
--filter=blob:none --depth=1 - Moves the folder contents to the current directory and cleans up
.git
License
MIT
Built with AI assistance (GitHub Copilot) for transparency.
