How to split a git repository while preserving subdirectories?

后端 未结 7 1574
轻奢々
轻奢々 2020-11-27 16:11

What I want is similar to this question. However, I want the directory that is split into a separate repo to remain a subdirectory in that repo:

I have this:

7条回答
  •  难免孤独
    2020-11-27 16:36

    If you wish split out just single directory as separate git repository

    git-filter-branch has --subdirectory-filter option and it is much simpler then previous mentioned solutions, just:

    git filter-branch --subdirectory-filter foodir -- --all
    

    Additionally it change path and place content of directory on top of new repo, not just filter and remove other content.

提交回复
热议问题