#git submodule sync
#git submodule update --init --recursive
#서브모듈로 추가(링크)
#git submodule add [저장소_URL]
#서브모듈 변경사항 반영
#git submodule update --remote --merge
#제거
#폴더 삭제, .gitmodule 에서 내용 삭제.
#서브모듈 이름 변경
#git mv 현재_서브모듈_이름 새로운_서브모듈_이름
#git submodule absorbgitdirs
# 모든 서브모듈 한 번에 업데이트
#git submodule foreach --recursive 'git checkout main || git checkout master; git pull'
서브모듈로 추가(링크)
git submodule add [저장소_URL]
서브모듈 변경사항 반영
git submodule update --remote --merge
제거
폴더 삭제, .gitmodule 에서 내용 삭제.
서브모듈 이름 변경
git mv 현재_서브모듈_이름 새로운_서브모듈_이름
git submodule absorbgitdirs
서브트리는 안적을랭
다른 Git 저장소를 링크로 하위 디렉토리에 포함시키는 기능
프로젝트를 서브모듈로 추가:
git submodule add [프로젝트_저장소_URL] [로컬_폴더명]
서브모듈을 포함하여 저장소 가져오기:
git clone --recursive [저장소_URL]
서브모듈 업데이트:
git submodule update --init --recursive
서브모듈 설정 제거:
git submodule deinit -f -- [로컬_폴더명]
Git 모듈 폴더 삭제:
rm -rf .git/modules/[로컬_폴더명]
서브모듈 폴더 삭제:
git rm -f [로컬_폴더명]
.gitmodules 파일에서 해당 서브모듈 관련 내용 삭제
변경사항 커밋 및 푸시:
git add .gitmodules
git commit -m "[로컬_폴더명] 서브모듈 제거"
git push origin main
다른 Git 저장소의 내용을 복사하여 현재 저장소의 하위 디렉토리로 통합하는 기능
프로젝트를 서브트리로 추가:
git subtree add --prefix=[로컬_폴더명] [저장소_URL] [브랜치] --squash
서브트리 내용 업데이트:
git subtree pull --prefix=[로컬_폴더명] [저장소_URL] [브랜치] --squash
서브트리의 변경사항을 원본 저장소로 푸시:
git subtree push --prefix=[로컬_폴더명] [저장소_URL] [브랜치]
서브트리 폴더 삭제:
git rm -r [로컬_폴더명]
변경사항 커밋 및 푸시:
git commit -m "[로컬_폴더명] 서브트리 제거"
git push origin main
주요 차이점: