Question:
I have a branch named BranchA from master. I have some changes in BranchA (I am not going to merge changes from BranchA to master).
Now I have created another branch from master named BranchB.
How can I copy the changes from BranchA to BranchB?
Answer:
git checkout BranchB
git merge BranchA
or if you didn't create BranchB yet you can do:
git checkout BranchA
git checkout -b BranchB
This is all if you intend to not merge your changes back to master. Generally it is a good practice to merge all your changes back to master, and create new branches off of that.
Also, after the merge command, you will have some conflicts, which you will have to edit manually and fix.
Make sure you are in the branch where you want to copy all the changes to. git merge will take the branch you specify and merge it with the branch you are currently in.