Split large Git repository into many smaller ones

前端 未结 5 2101
故里飘歌
故里飘歌 2020-11-27 10:12

After successfully converting an SVN repository to Git, I now have a very large Git repository that I want to break down into multiple smaller repositories and maintain hist

5条回答
  •  野性不改
    2020-11-27 10:28

    Thanks for your answers but I ended up just copying the repository twice then deleting the files I didn't want from each. I am going to use the filter-branch at a later date to strip out all the commits for the deleted files since they are already version controlled elsewhere.

    cp -R MyHugeRepo MyABRepo
    cp -R MyHugeRepo My12Repo
    
    cd MyABRepo/
    rm -Rf DIR_1/ DIR_2/
    git add -A
    git commit -a
    

    This worked for what I needed.

    EDIT: Of course, the same thing was done in the My12Repo against the A and B directory. This gave me two repos with identical history up to the point I deleted the unwanted directories.

提交回复
热议问题