I\'ve found how you can copy a file wholesale from one branch to another:
Edit please note, if you think this question is a duplicate
You can use git restore
git restore --source feature-B directory/somefile.php
I didn't pass any option saying where it should restore the file and by befault it's working directory (without index/staging area). From documentation:
> -W > --worktree > -S > --staged > > Specify the restore location. If neither option is specified, by default the working tree is restored. Specifying --staged will only restore the index. Specifying both restores both.
you could use git show and then redirect... it's not very elegant, though
git show feature-B:directory/somefile.php > directory/somefile.php