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.
Asked
Active
Viewed 37 times
-1
-
Does this answer your question? [How do I copy a version of a single file from one git branch to another?](https://stackoverflow.com/questions/307579/how-do-i-copy-a-version-of-a-single-file-from-one-git-branch-to-another) – Dev-vruper Mar 05 '21 at 10:42
1 Answers
0
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

Ôrel
- 7,044
- 3
- 27
- 46