Monday, December 22, 2014

Retrieve a single file from a git repo.

The answer to this was more difficult to find than it should have been. The best answer is on stackoverflow here.

In short, use the git archive command:

git archive --prefix=path/to/ HEAD:path/to/ |  tar xvf -

  • For this to work the owner of the git server needs to have enabled upload-archive (git config daemon.uploadarch true)
  • You need tar -xvf because the output is in tar form

No comments:

Post a Comment