I have folder name utils
I want to copy
this folder from master
branch to work
branch. How do I do that ?
The easiest way to copy files and folders from within a working tree is to use the right-drag menu. When you right-drag a file or folder from one working tree to another, or even within the same folder, a context menu appears when you release the mouse.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With