Short Answer
It is possible to do (in the deployed repository):
git fetch --all
// git fetch will download all the recent changes, but it will not put it in your current checked out code (working area).
Followed by:
git checkout origin/master -- path/to/file
// git checkout <local repo name (default is origin)>/<branch name> -- path/to/file will checkout the particular file from the downloaded changes (origin/master).
Full Example
$ cd /project/directory
$ git branch
* develop
check the remote name
$ git remote -v
origin git@github.com:abc/123.git
Confirmed it's origin
and
I am on branch develop
and need a file from branch main
File i need is src/scss/main.scss
git fetch --all
git checkout origin/main -- src/scss/main.scss
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…