There are numerous tutorials on how to split a large git repository (LargeRepo) into smaller repositories (SmallRepoA, SmallRepoB) and preserve commits. I'd like to do that with the added requirement that each SmallRepo inherits only those branches and branch commits that are relevant to the files in the SmallRepo.
For each SmallRepo:
- Don't maintain a branch if the branch has no affect on the files in SmallRepo
- For the remaining branches, remove commits that have no affect on the files in SmallRepo.
Effectively, I'm trying to get the end result to micmic what the world would look like if I had the individual SmallRepos to begin with.
Here's an example:
Lets say LargeRepo looks like this:
LargeRepo
|---- Folder1
|---- Folder2
|---- Folder3
And I want to split into three SmallRepos, one for each high-level Folder.
Folder1
Folder2
Folder3
Lets say LargeRepo had Branch1 and Branch23. Branch1 made changes to files in Folder1, Branch23 made changes to files in Folder2 and Folder3.
The branch view would look like this:
Folder1
|----> Branch1 (all commits)
Folder2
|-----> Branch23 (only commits affecting files in Folder2)
Folder3
|------> Branch23 (only commits affecting files in Folder3)
Ideally the solution can be implemented with the git command-line on Windows and would not involve BASH.