How do I obtain a single revision from a git repository without cloning the whole repository?
Note: this question has been asked 100s of times but I have yet to see an answer that solves it since they all start with "clone the whole git repository". This cannot be done in my use case.
The best I can do is:
- Find the depthof the commit.
- Clone until that depth: git clone --depth $depth $git_repo_url.
- Checkout and reset: git checkout $commit_hash; git reset --hard.
But this still requires cloning up to the commits depth.
Is there a way to avoid that and clone only a particular commit with depth 1?
 
     
     
    