gitsparse vs. other ways to grab one folder

gitsparse isn't the only way to do this. Here's the honest comparison, including when it's the wrong tool for the job.

Quick comparison

MethodInstallFetchesPrivate repos
gitsparseNothingJust the folderYes, with a token
git sparse-checkoutgitJust the folderYes
degitNodeWhole repo tarballYes (slower mode)
svn exportsvnJust the folderPublic only
DownGitNothingJust the folderYes, with auth
GitZip extensionBrowser extensionJust what you pickYes, with auth
GitHub's "Download ZIP"NothingWhole repoYes

git sparse-checkout

The proper tool. A blobless partial clone plus a sparse-checkout pattern gets git itself to fetch only your folder's files, and you keep history and the ability to pull updates later. It's also the only option here that handles a folder changing over time well — re-run git pull instead of re-downloading a zip. The tradeoff is just remembering the commands, which is the entire reason gitsparse exists; see the terminal instructions for the exact ones.

degit

Built for scaffolding: it strips git history on purpose, which is exactly what you want when copying a template folder to start a new project. The part people don't expect is what it fetches to get there — degit downloads a compressed tarball of the entire repository at that commit, then discards everything outside the folder you asked for locally. Fine for a small or medium repo; for a large monorepo you're still paying for the whole tarball's bandwidth even though you only keep one folder.

svn export

A long-running trick: GitHub exposes a subset of the Subversion protocol over every git repo, so swapping tree/main for trunk (or branches/main) in the URL and running svn export on it pulls down just that folder, no git history, no extra tooling beyond svn itself. It still works today for public repos. It's unofficial, though — GitHub's docs don't commit to the SVN bridge staying around, and it doesn't have an obvious path for private repos the way a personal access token does for the other options here.

DownGit

The closest thing to gitsparse already out there — it's a web tool that does fundamentally the same thing: read a folder via GitHub's API, zip it client-side, no server storing your files. The difference is workflow, not capability: DownGit means copying a GitHub URL, leaving the tab, pasting it into a separate site, and waiting for a preview. gitsparse skips that round trip — you just edit the domain in the address bar you're already on. Pick whichever habit fits; functionally they land in the same place.

GitZip (browser extension)

Worth it specifically when you want files from several different folders in the same repo in one download — gitsparse and DownGit both assume one subtree. The cost is installing a browser extension and granting it access, which is a bigger ask than a page you can ignore when you're done with it.

GitHub's own "Download ZIP" button

Zero setup, official, and the first thing most people try — but it only ever packages the whole repository. There's no folder-scoped version of it in GitHub's web UI, which is the actual gap every tool on this page, gitsparse included, exists to fill.

When gitsparse is the wrong choice

  • You need commit history, not just the current files — use git directly.
  • You'll re-grab the same folder repeatedly as it changes — set up sparse-checkout once and pull instead of re-downloading each time.
  • The folder is over the 10MB zip limit — none of the CLI-based options have that ceiling.
  • You need scattered individual files from several unrelated folders — GitZip's per-file picker fits that better than a single subtree.