0Pricing
Git Advanced: Monorepo, Submodules & Workflows · 강의

Git 서브모듈 소개

Git 서브모듈이 무엇인지, 어떤 경우에 사용하는지, 종속성 관리에 적합한 해결책이 되는 시점을 이해합니다.

Git 서브모듈 소개은(는) CoddyKit의 무료 Git Advanced: Monorepo, Submodules & Workflows 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Git Advanced: Monorepo, Submodules & Workflows 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Welcome to Submodules

What are Git Submodules? They let you embed one Git repository inside another as a sub-directory. It's like having a separate project living inside your main project, but still managed independently.

Why Use Submodules?

Imagine your project needs a specific library or component that's developed and maintained separately. Instead of copying its code, you can use a submodule.

  • Vendor Code: Include third-party libraries.
  • Shared Components: Reusable code across multiple projects.
  • Plugin Systems: Modularize parts of a larger application.

A Repo within a Repo

A submodule isn't just a folder of files. It's a pointer to a specific commit in another Git repository. Your main project tracks which commit of the submodule it should use.

This means your main project doesn't directly manage the submodule's content, but rather its reference.

How Git Tracks Submodules

Git stores submodules as a special entry in your main repository's index. It records the submodule's path, the URL of its remote repository, and the specific commit hash it currently points to.

When you clone a project with submodules, you'll initially see empty directories until you initialize and update them.

Submodule's Independent Life

Each submodule is its own standalone Git repository. You can clone it, switch branches, commit changes, and push them, all independently of the parent repository.

This isolation is key to managing external dependencies without merging their history into your main project.

Common Use Cases

Submodules are excellent for:

  • Stable Dependencies: When you need a specific version of an external library and don't want it to change unexpectedly.
  • Large Components: Breaking down a monolithic project into smaller, manageable, independently versioned parts.
  • Open-Source Contributions: Integrating external tools or frameworks without maintaining their source directly.

When Submodules Shine

They are particularly useful when:

  • You need to track a specific version of a dependency, not just the latest.
  • The dependency is managed by a different team or project.
  • You want to keep the dependency's history separate from your main project's history.

The .gitmodules File

When you add a submodule, Git creates a special configuration file at the root of your main repository: .gitmodules.

This file stores the mapping between the submodule's local path and its remote URL. It's version-controlled, so everyone cloning your project knows about its submodules.

[submodule "library"]
  path = lib/my-library
  url = https://github.com/user/my-library.git

Subtree vs. Submodule (Brief)

While submodules are great, they have alternatives. One notable option is Git Subtree.

Submodules keep the dependency's history separate, while Git Subtree integrates the dependency's history directly into your main repository. We'll explore Subtree in a later lesson!

Quick Check on Submodules

Let's check your understanding of Git submodules.

Recap: Intro to Submodules

We've introduced Git submodules, understanding them as a way to embed independent Git repositories within your main project.

  • They track specific commits of external repos.
  • They solve problems of shared code and stable dependencies.
  • They are configured via the .gitmodules file.

Next, we'll learn how to add and clone submodules.

자주 묻는 질문

“Git 서브모듈 소개” 강의는 무료인가요?

네 — “Git 서브모듈 소개” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Git Advanced: Monorepo, Submodules & Workflows 강의 전체를 잠금 해제할 수 있습니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

“Git 서브모듈 소개”에서 뭘 배우나요?

Git 서브모듈이 무엇인지, 어떤 경우에 사용하는지, 종속성 관리에 적합한 해결책이 되는 시점을 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 Git Advanced: Monorepo, Submodules & Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Git Advanced: Monorepo, Submodules & Workflows을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Git Advanced: Monorepo, Submodules & Workflows은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.

“Git 서브모듈 소개” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Git Advanced: Monorepo, Submodules & Workflows 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Git Advanced: Monorepo, Submodules & Workflows 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. Git 서브모듈 소개
  2. 서브모듈 추가 및 복제
  3. 서브모듈 업데이트 및 동기화
  4. 서브모듈 제거 및 초기화 해제
← Git Advanced: Monorepo, Submodules & Workflows(으)로 돌아가기