Git Copy a folder from master branch to another branch

git, github

Solution

To copy the folder over:

$ git checkout work
Switched to branch 'work'
$ git checkout master -- utils
$ git add utils
$ git commit -m "Adding 'utils' directory from 'master' branch."
[work 9fcd968] Adding 'utils' directory from 'master' branch.
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 utils/file

If you want to delete it on `master` after that:

$ git checkout master
Switched to branch 'master'
$ git rm -r utils
rm 'utils/file'
$ git commit -m "Removing 'utils' directory."
[master c786f95] Removing 'utils' directory.
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 utils/file

Then you can just `git push` as necessary. Git's output in your project may be different; I just made a simple test repo here with only one file in the `utils` directory.

Problem

I have folder name `utils` I want to `copy` this folder from `master` branch to `work` branch. How do I do that ?

Original source