Git Protip: Copy a file from another branch

22 Apr

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: