Posts

Showing posts with the label snippet

Converting a Subfolder of a Git Repository into a Separate Repository with Preserved History

Converting a Subfolder of a Git Repository into a Separate Repository with Preserved History While a git-tracked project grows, it is commonplace to separate project parts as individual projects, still controlled by git with additionally preserved prior history related to the content of the separated folder. Such separation is very useful if you, like me, keep a single closed git repository at GitHub with all the draft projects inside, once in a while opening the ones that you consider to be ready for a public release. Below is the step-by-step guide on how to extract a subfolder into a separate distinct git project. For the examples below, the bigger project will be called PARENT, situated in a folder PARENT that is git-tracked and pushed into GitHub with the following address: https://github.com/USERNAME/PARENT.git . The subproject to be separated will be called OFFSPRING, situated in the subfolder PARENT/OFFSPRING, to be pushed into a new GitHu...