I want to remove a file from existing branch and add it in another existing branch. For example I have two branch a and b. I'm in branch a and I want to remove a file a.php from branch a and add to this file in existing branch b.
First add a.php into branch B:
Checkout branch B:
git checkout branchB
Checkout file from branchA
git checkout branchA a.php
Then commit this file
git commit
Then delete a.php from branchA
Checkout branch A:
git checkout branchA
Delete the file
git rm a.php
And commit the deletion
git commit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.