views:

132

answers:

1

Assume my git repository has the following structure:

/.git
/Project
/Project/SubProject-0
/Project/SubProject-1
/Project/SubProject-2

and the repository has quite some commits. Now one of the subprojects (SubProject-0) grows pretty big, and I want to take SubProject-0 out and set it up as a standalone project. Is it possible to extract all the commit history involving SubProject-0 from the parent git repository and move it to a new one?

+3  A: 

See http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html

I think you need something like

git filter-branch --subdirectory-filter Project/SubProject-0 -- --all

in a clone of the repository.

Christoffer Hammarström
Thanks! Works like a charm!
Rio
@Rio You may also want to use the `--prune-empty` option to expunge commits that touched only `Project/SubProject-0`.
Greg Bacon
wow works perfectly! thanks
alvatar