Let say you are on the master branch and you want to do some devs without messing up your master. What one usally do is create a new branch dev based on the main branch (in this case master) and do all the developments there.
Sometimes you may want to copy just one or two files from this dev branch without merging the whole branch with master.
The easiest way to do so is the following (assuming you are in another branch than dev):
git checkout dev -- path/to/your/file
Note that you can also get a whole folder, all the files inside this folder will be copied:
git checkout dev -- path/to/your/folder
For more informations on checkout, take a look at the man page git checkout