I am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this
This can be the solution:
git fetch
git checkout origin/master -- FolderPathName/fileName
Thanks.
I was looking for slightly different task, but this looks like what you want:
git archive --remote=$REPO_URL HEAD:$DIR_NAME -- $FILE_NAME |
tar xO > /where/you/want/to/have.it
I mean, if you want to fetch path/to/file.xz
, you will set DIR_NAME
to path/to
and FILE_NAME
to file.xz
.
So, you'll end up with something like
git archive --remote=$REPO_URL HEAD:path/to -- file.xz |
tar xO > /where/you/want/to/have.it
And nobody keeps you from any other form of unpacking instead of tar xO
of course (It was me who need a pipe here, yeah).