I am searching for an easier way to copy specific files and directories from 1 git branch to another without committing them.
Ex:
- 2 branches -
dev
andprod
- File
service/web/company.html
is present in bothdev
andprod
branches. I want to copy this file fromdev
toprod
, modify it a bit and then commit it toprod
.
At the moment what I do is:
Clone the git repository 2 times into separate directories (git_dev & git_prod) and switch their branches (
git checkout
).cp -f git_dev/service/web/company.html git_prod/service/web/company.html
There are files and directories currently committed to the dev
branch that I want to copy to the prod
branch, modify them and then commit them to the prod
branch.