Software Engineer

Move more than one directory into a new repository

I just realized that my previous post on how to move one directory from one repository to another really only works for one directory.

Fortunately, there is a very easy solution to that using a nice little tool called git_filter.

Basically follow the instructions of it’s README. Then, all I did was put the two directories into the filter file. It is important to note here that this file had to end with an empty line in my case, otherwise the last directory will be ignored.

You will get a new branch, which can be pushed to an empty repository:

git remote add origin_repoB <url of repo>
git push origin_repoB <localBranch>:master

It also works for one directory and is a lot faster compared to the other method.

2 Comments

  1. haripal

    Can you show examples for this scenario ?

    • Matthias Schoettle

      There’s an example config file and filter lists in the git repository that is linked in the post, did you check that out?

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 Matthias Schoettle

Theme by Anders NorenUp ↑