Checkout a single file from Git repo

This one going to be quick and putting here just for future reference.

Task
Checkout a single file from Git without cloning whole repo

Solution

git archive --prefix=config/ --remote=git@git.example.com:/app.git HEAD:app/config/ config.yaml | (cd /usr/local/app && tar xf -)

Posted in: Git |

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.