I have a generic git repository called Workspace and each project I have that isn't big enough to deserve its own repository is stored as a folder within it. One of my mini-projects is now big enough that I feel it should have its own repository. I could easily make this happen by just copying the latest revisions into their own repository and committing them, but this doesn't transfer any of the previous revisions or history to the new repository. Is there a way to take a subfolder of a repo and make it its own repo without losing history?
I'm also fine with answers that only work for GitHub in case that has special features.
1 Answer 1
This is a common workflow; the Git team even added a command for it: git subtree
will convert the directory into a submodule.
See this StackOverflow answer for more details: Detach subdirectory into separate Git repository: The Easy WayTM.
-
Tell Brennan that he is not my senpai anymore.Sean Allred– Sean Allred05/09/2015 02:42:25Commented May 9, 2015 at 2:42
-
1I shall break his heart without mercy.Joshua Snider– Joshua Snider05/09/2015 02:43:16Commented May 9, 2015 at 2:43