1234567891011121314151617181920
## MAIN_PROJ_PATH: 需要被拆分的主工程路径## SUB_PROJ_RELATIVE_PATH: 需要拆分出来的子工程相对于主工程的路径## SOME_NAME: 任意取的某个分支名## SUB_PROJ_NAME: 子工程项目名## GIT_REMOTE_URL: 子工程指向的仓库地址cd MAIN_PROJ_PATHgit subtree split -P SUB_PROJ_RELATIVE_PATH -b SOME_NAMEcd ..git clone -b SOME_NAME MAIN_PROJ_PATH SUB_PROJ_NAMEcd SUB_PROJ_NAMEgit branch -m mastergit remote remove origingit remote add origin GIT_REMOTE_URLgit push -u origin mastercd MAIN_PROJ_PATHgit branch -D SOME_NAME