Detach many subdirectories into a new, separate Git repository
Posted
by prisonerjohn
on Stack Overflow
See other posts from Stack Overflow
or by prisonerjohn
Published on 2010-06-05T20:51:53Z
Indexed on
2010/06/05
21:02 UTC
Read the original article
Hit count: 253
git
|git-filter-branch
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
© Stack Overflow or respective owner