So, I've a bigger (closed source) project, and in the context of this project created a library which could also be useful elsewhere, I think.
I now want to split off the library in its own project, which could go as open source on github or similar. Of course, the library (and its history there) should contain no traces of our project.
git-subtree seems like a solution here, but it does not completely fit.
My directory layout is something like this (since it is a Java project):
- fencing-game (git workdir)
- src
- de
- fencing_game
- transport (my library)
- protocol (part of the library)
- fencing (part of the main project interfacing with the library)
- client (part of the main project interfacing with the library)
- server (part of the main project interfacing with the library)
- client (part of the main project)
- server (part of the main project)
- ... (part of the main project)
- transport (my library)
- fencing_game
- de
- other files and directories (build system, website and such - part of the main project)
- src
After the split, I want the library's directory layout look like this (including any files directly in the bold directories):
- my-library (name to be determined)
- src
- de
- fencing_game
- transport (my library)
- protocol (part of the library)
- transport (my library)
- fencing_game
- de
- src
The history should also contain just the part of the main project's history which touches this part of the repository.
A first look showed me git-subtree split --prefix=src/de/fencing_ame/transport
, but this will
- give me a tree rooted in
transport
(which will not compile) and - include the
transport/client
,transport/server
andtransport/fencing
directories.
The first point could be mitigated by using git subtree add --prefix=src/de/fencing_ame/transport <commit>
on the receiving side, but I don't think git-subtree can do much against exporting also these subdirectories. (The idea really is to just be able to share the complete tree here).
Do I have to use git filter-branch
here?
After the split, I want to be able to import back the library in my main project, either using git-subtree or git-submodule, in a separate subdirectory rather than where it is now. I imagine the layout this way
- fencing-game (git workdir)
- src
- de
- fencing_game
- transport (empty)
- fencing (part of the main project interfacing with the library)
- client (part of the main project interfacing with the library)
- server (part of the main project interfacing with the library)
- client (part of the main project)
- server (part of the main project)
- ... (part of the main project)
- transport (empty)
- fencing_game
- de
- my-library
- src
- de
- fencing_game
- transport (my library)
- protocol (part of the library)
- transport (my library)
- fencing_game
- de
- src
- other files and directories (build system, website and such - part of the main project)
- src