GIT: Create branch only with certain files from master

git

Solution

It sounds like you want to create a new branch as usual, then prune its contents using `git filter-branch`.

Problem

I would like to create a branch that would contain only certain files from master. Let's say master contains several directories as follows: ``` app app/test app/dev ... ``` What I want to achieve is checking out contents of `app/test` into new branch and putting them into directory root, so it looks like this: ``` root - file from app/test - another file from app/test ... ``` Is this possible? In general what I want to do is pushing only some files (the new branch) to remote different from origin. This was the first idea I got, if there is simpler solution, please let me know. Thanks.

Original source