Tag Archives: sourcecontrol

Migrate Section of a Git Repo to a new Git Repo

I inherited a git repo that has multiple projects in it. It’s easier to manage the code and dependencies if each of these projects are in their own git repo.

The process is pretty simple:

  1. Export the directory you plan to use as the starting point of the new repo
  2. Create the new repo
  3. Import the old repo

  1. Export the directory
git log --pretty=email --patch-with-stat --reverse --full-index --binary DIRECTORY > /tmp/DIRECTORY_patch;

2. Create the new repo

git init REPONAME;

3. Import the old


git am < /tmp/DIRECTORY_patch;

Run ‘git log’ to verify that you’ve successfully import the repo.