Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and
You can simply fetch the remote repo with:
git fetch
where,
can be a remote repo name (e.g. origin) or even a remote repo URL (e.g. https://git.foo.com/myrepo.git)for example:
git fetch https://git.foo.com/myrepo.git
after you fetched the repos you may merge the commits that you want (since the question is about retrieve one commit, instead merge you may use cherry-pick to pick just one commit):
git merge
can be the SHA1 commitfor example:
git cherry-pick 0a071603d87e0b89738599c160583a19a6d95545
or
git merge 0a071603d87e0b89738599c160583a19a6d95545
if is the latest commit that you want to merge, you also may use FETCH_HEAD variable :
git cherry-pick (or merge) FETCH_HEAD