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/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).
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
Vinod Ram has been in Software Industry since 2006 and has experience of over 16 years in Software Development & Project Management domain specialised majorly in LAMP stack & Open Source Technology, building enterprise level Web based Application, Large Database driven and huge traffic Websites and Project Management.
He loves to write information articles and blog to share his knowledge and experience with the outside world and help people to find solution for their problems.