1. git拆分仓库并保留历史
    首先删除不需要的文件夹
    git filter-branch –force –index-filter ‘git rm -rf –cached –ignore-unmatch target_directory ‘ –prune-empty –tag-name-filter cat — –all

  2. git删除空提交内容
    git filter-branch –tag-name-filter cat –commit-filter ‘git_commit_non_empty_tree "$@"’ — –all

  3. 提交新仓库
    git remote add origin 地址
    git push -f | -u 推送提交至指定仓库