Git Protip: Copy a file from another branch

22Apr

It occasionally happens that I’ve fixed a bug in BRANCH_A and while BRANCH_A is waiting to be merged, I create a new branch (BRANCH_B) for further development/bugfixing, but wait! I really need the bugfix in BRANCH_A in order to continue in BRANCH_B.

This can easily be solved using the following git command (from your working branch, BRANCH_B):