μ„œλΈŒλͺ¨λ“ˆ(Git Submodule)은 ν•˜λ‚˜μ˜ Git 리포지토리 μ•ˆμ— λ‹€λ₯Έ Git 리포지토리λ₯Ό 포함 ν•΄μ„œ μ‚¬μš©ν•˜λŠ” λ°©μ‹μž…λ‹ˆλ‹€. λ³΅μž‘ν•œ ν”„λ‘œμ νŠΈλ₯Ό λΆ„λ¦¬ν•˜μ—¬ 관리할 λ•Œ μœ μš©ν•˜μ§€λ§Œ, 일반적인 ν”„λ‘œμ νŠΈμ—μ„œλŠ” 관리가 κΉŒλ‹€λ‘­μŠ΅λ‹ˆλ‹€.

🧩 μ„œλΈŒλͺ¨λ“ˆ ꡬ쑰 μ˜ˆμ‹œ

my-project/
β”œβ”€β”€ .gitmodules
β”œβ”€β”€ main-code/
└── shared-lib/  ← μ™ΈλΆ€ 리포지토리 μ—°κ²° (μ„œλΈŒλͺ¨λ“ˆ)

예λ₯Ό λ“€μ–΄, shared-lib이 별도 GitHub 리포이고 my-project μ•ˆμ— ν¬ν•¨ν•œ κ²½μš°μž…λ‹ˆλ‹€.

πŸ”§ μ„œλΈŒλͺ¨λ“ˆ κΈ°λ³Έ 관리 방법

1. μ„œλΈŒλͺ¨λ“ˆ μΆ”κ°€

git submodule add <https://github.com/μ‚¬μš©μžλͺ…/레포.git> shared-lib

2. 클둠 μ‹œ ν•¨κ»˜ λ°›μ•„μ˜€κΈ°

git clone <https://github.com/λ‚΄λ ˆν¬.git>
cd λ‚΄λ ˆν¬
git submodule update --init --recursive

λ˜λŠ” ν•œ μ€„λ‘œ:

git clone --recurse-submodules <https://github.com/λ‚΄λ ˆν¬.git>

3. μ„œλΈŒλͺ¨λ“ˆ μ—…λ°μ΄νŠΈ

μ„œλΈŒλͺ¨λ“ˆ λ‚΄λΆ€λ‘œ λ“€μ–΄κ°€μ„œ μž‘μ—…ν•œ ν›„, λ£¨νŠΈμ—μ„œ λ‹€μŒ λͺ…λ ΉμœΌλ‘œ μ—…λ°μ΄νŠΈ 반영:

cd shared-lib
git checkout main
git pull origin main
cd ..
git add shared-lib
git commit -m "chore: update shared-lib submodule"