I'm trying to use 15 directories from the rootdir of one git repo ("FOO") in a larger project. Changes will be made to these files in the larger project and pulled back into the "FOO" repo. I logically want to git subtree split --rejoin
those directories into a branch in "FOO" and then add/pull that branch up to the larger project. Said another way, I want to keep 1-2 directories private in the "FOO" repo and not add/sync them up to the larger project.
However, when looking through the git docs and SO threads, it appears that this is not supported with git subtree split
(see linked thread) unless I make each directory a subtree or I use git filter-branch
to rewrite the history.
Git subtree and multiple directories
Often git filter-branch
is suggested as a solution but that appears to break any syncing back into the original "FOO" repo. From git filter-branch --help
: The rewritten history will have different object names for all the objects and will not converge with the original branch . Any changes to the "FOO" repo structure (like putting the 15 dirs under a new dir via filter-branch
) is not possible at this time.
Am I stuck with treating each directory as a subtree? Doing 15 subtree splits in the larger repo (to sync back to "FOO" will take a significant amount of time. Are there any tricks to optimizing this (e.g. 1 pass through the large repo's commits but create a branch for each folder's commits)?