tags:

views:

45

answers:

1

Is there a way to create a new git repository from an existing one, the new repository should include only files located in the specified subfolder and only commits that affects these files?

+1  A: 

I think you are looking for:

git filter-branch --subdirectory-filter foodir -- --all

(Example taken from the git documentation)

Chris Shaffer
yes, that's almost it. but how can I keep my project root folder the same? I want all my files have their location unchanged
whitered
To keep the location unchanged within the repository, you would probably use the --tree-filter parameter instead of the --subdirectory-filter, and pass a shell command that would delete everything except the directory you want to keep.
Chris Shaffer