Skip to content

Split a Git Project

neurite edited this page Apr 25, 2017 · 3 revisions

How to split a Git project and keep its history.

Suppose we have an existing project, project A. We want to split it into 2 projects, B and C.

  1. Create an empty Git repo for project B with no history in it.
  2. In the existing project, project A, add a remote which points to the empty repo of project B.
  3. Push the existing project to the new remote. Now project B has a copy of project A including its history.
  4. In project B, remove the parts that are not B.
  5. Repeat steps 1 - 4 for project C.

Merge project

git pull <another-project> <branch> --allow-unrelated-histories

Clone this wiki locally