Pretty early on I made a directory (we'll call this "parent directory") a git repo and started storing all of my school projects in their own subdirectories. Each subdirectory contains its own unique and separate project. I realize now this was a mistake and I need each subdirectory to be its own individual repository, while also keeping intact the commit history for each subdirectory. I also need to undo the repo on the parent directory. Is there any way to do this?
Asked
Active
Viewed 85 times
0
-
1[I've done this.](https://stackoverflow.com/a/54797306/1290731) – jthill Apr 06 '23 at 20:18
-
1https://stackoverflow.com/a/17864475/7976758 and https://stackoverflow.com/a/58983975/7976758 Found in https://stackoverflow.com/search?q=%5Bgit%5D+split+directory – phd Apr 06 '23 at 20:27
1 Answers
0
GitHub has a pretty handy guide, with specific instructions for a variety of operating systems: https://docs.github.com/en/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository
The core of those instructions, for every OS, is to use git-filter-repo to split the original repo by path. After that, for each new repo, it's just a matter of setting up one or more remote paths; setting up space on your remote; and pushing the new repo to the remote.

Jim Redmond
- 4,139
- 1
- 14
- 18