Book Image

Git Version Control Cookbook

Book Image

Git Version Control Cookbook

Overview of this book

Table of Contents (19 chapters)
Git Version Control Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Splitting a repository


Sometimes a project tracked with Git is not one logical project but several projects. This may be fully intentional and there is nothing wrong with it, but there can also be cases where the projects tracked in the same Git repository really should belong to two different repositories. You can imagine a project where the code base grows and at some point in time, one of the subprojects could have value as an independent project. This can be achieved by splitting the subfolders and/or files that contain the project that should have its own repository with the full history of commits touching the files and/or folders.

Getting ready

In this example, we'll use the JGit repository so we'll have some history to filter through. The subfolders we split out to are not really projects, but serve well as an example for this exercise.

  1. First, clone the Jgit repository and create local branches of the remote ones using the following command:

    git clone https://git.eclipse.org/r/jgit...