submodule 과 가장 큰 차이는 하나의 .git에서 관리한다는 것
git subtree init.gitmodules
같은거 안만들고
- config 에 remote등록해서 관리
- 그냥 아무렇게 수정하고 커밋하고 push pull만 여러군대 해주면 알아서 해당 커밋만 간다
- submodule이 의식하며 개발해야한다는 것이 가장 큰 차이
프로젝트간 dependency가 있으면 subtree가 더 간편하다
Git repo로서 가져오는 것이 아니라 단순히 디렉토리/파일을 가져오므로 디렉토리에는 Git repo 설정을 담고 있는 .git 디렉토리가 없다.
Sub Repo
git init git add . git commit -am "first commit" git remote add origin {{repo}} git push -u origin --all cd ../ rm {{folderpath}}
Main Repo
git remote add {{name}} {{repo}} git subtree add --prefix {{folderpath}} {{remote}} {{branch}}
Update from main repo
git subtree push --prefix {{remote}} {{folderpath}} {{branch}}