How to download latest copy of a file from gitlab branch

I had code on my gitlab repository, Another person is also working on the same code . He had committed , pushed and merged his changes on the master branch. Now i just have to update only one file in my local working copy.

So this is possible by using the below two command.

git fetch
// git fetch will download all the recent changes, but it will not put it in your current checked out code (working area).

git checkout origin/masterpath/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).

You can also pull specific files to your working copy from another branch as well. You just need to replace “origin/master” with your desired branch name.

When you fire git status command

git status
// it will show the fetched files as modified