RSS

Category Archives: Git

Git Protip: Copy a file from another branch

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):

git checkout BRANCH_A myfile.txt
 
Leave a comment

Posted by on April 22, 2013 in Git

 

Tags: ,