I am wondering if it's possible to fetch only a single file from a Git repository in order to commit a new change to it. We want to change the file on a Azure DevOps Hosted Agent however downloading the entire repo would take a significantly long time, as it is large.
I read of these options:
- --Filter option
- Git sparse checkout (I'm not sure if this is only available on GitHub)
- Microsoft GVFS
Filter command attempt
git clone --depth 1 --filter=sparse:path=ReadMe.md
warning: filtering not recognized by server, ignoring
Sparse checkout
git config core.sparsecheckout true
echo File.txt >> .git/info/sparse-checkout git pull origin master
However it still retrieved everything.
The server repository is running GIT v2.18.
- Is there anything that needs to be configured on the server to make it these work?
- Is the --filter option only available on certain versions?
- Could GVFS achieve this and is it possible to setup on the Hosted Agent?
Thank you.