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?
- 1I've done this.jthill– jthill2023-04-06 20:18:20 +00:00Commented Apr 6, 2023 at 20:18
- 1stackoverflow.com/a/17864475/7976758 and stackoverflow.com/a/58983975/7976758 Found in stackoverflow.com/search?q=%5Bgit%5D+split+directoryphd– phd2023-04-06 20:27:05 +00:00Commented Apr 6, 2023 at 20:27
Add a comment |
1 Answer
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.