by tyingq · 2y ago · 0 comments
git archive --remote=ssh://host/pathto/repo.git HEAD README.md | tar xO
Though apparently support depends on how you're running git, and potentially some enabled server side options.[1] https://stackoverflow.com/questions/1125476/retrieve-a-singl...
git clone --filter=tree:0 --depth=1 --sparse --no-checkout && git checkout HEAD <desired_file>
(But that would still end up fetching a few more objects than just the desired file.)
(I would assume git doesn't trust the server, and will verify that the chain of hashes works out.)