I've read "Detach subdirectory into separate Git repository" but I'm not quite sure how to use this to achieve what I'm looking for. We currently have one large project that contains our schema/entities, our front-end web processes, and 2 versions of our REST API. I'd love to separate all of this into separate repositories if possible. Here's the kind of directory structure we have at the moment:
lib/Project/Entity/*.pm
lib/Projcet/Data/*.pm
lib/Project/Server/Controller/*.pm
lib/Project/Server/Controller/WS/1/*.pm
lib/Project/Server/Controller/WS/2/*.pm
lib/Project/Server/Form/*.pm
And so on. I'd like to be able to take the Entity
and Data
directories and move them to a new repository, and preferably move them as well:
lib/Project/Schema/Entity/*.pm
lib/Project/Schema/Data/*.pm
With the remaining files I'd like to split them apart into 2 more repositories, one for our front end server, and one for the REST API. I figure even though the REST API has 2 different versions we can split this into 2 separate branches (v1 and v2 branches).
I feel like filter-branch is pretty much exactly what I want (maybe with additional commits on top to move files), but I can't quite see exactly how to make this happen. Does anyone have any advice?
I should add that maybe git rm --ignore-unmatch
might be what I want, but the file structure in HEAD at the moment is most certainly not what the structure was in older commits (this repository spans almost a decade of history). What I really want is "take commits that touch these files: foo
but ignore all other commits. Sort of like a UNION of git log :)