Detach many subdirectories into a new, separate Git repository
- by prisonerjohn
This question is based on http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository
Instead of detaching a single subdirectory, I want to detach a couple. For example, my current directory tree looks like this:
/apps
/AAA
/BBB
/CCC
/libs
/XXX
/YYY
/ZZZ
And I would like this instead:
/apps
/AAA
/libs
/XXX
The --subdirectory-filter argument to git filter-branch won't work because it gets rid of everything except for the given directory the first time it's run. I thought using the --index-filter argument for all unwanted files would work (albeit tedious), but if I try running it more than once, I get the following message:
Cannot create a new backup.
A previous backup already exists in refs/original/
Force overwriting the backup with -f
Any ideas? TIA