In Git, branches may be a part of your everyday development process. When you want to add a new feature or fix a bug - you spawn a new branch to encapsulate your changes.

Sometimes, you changed some files in a feature branch for new feature and your teammate also starts to dev another feature before your feature is merged into master branch. Unfortunately,  your teammate new to use some functions which is created in your feature branch. The feature which you are developing has not finished yet, so you can't merge it into master.  We just need to merge specific files from feature to master.

For example, we have a branch called Feature. In that branch, we have a file called helper. We want to merge the helper file from Feature to Master to start another feature.



We need 2 following steps:

1.Checkout helper file to current working tree. 

 In git we can checkout a specific files from specific branch like the following:
git checkout <branch> <paths>
So , for example, we can get helper file which is in app/helper/application_helper.rb
git checkout feature app/helper/application_helper.rb

 2.Commit it to master branch.

We have helper file in working tree now. So, you just commit it into master branch for new feature.