0Pricing
Git Advanced: Monorepo, Submodules & Workflows · Ders

Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme

İleri düzey iş akışlarında yeniden üretilebilir derlemeler ve bilinçli, incelenebilir bağımlılık güncellemeleri sağlamak için bir alt modülün tam olarak hangi commit'e veya etikete işaret ettiğini denetlemeyi öğrenin.

Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme, CoddyKit'te ücretsiz bir Git Advanced: Monorepo, Submodules & Workflows dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Git Advanced: Monorepo, Submodules & Workflows öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Git Advanced: Monorepo, Submodules & Workflows kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Submodules Pin Commits, Not Branches

A common misconception: a submodule tracks a branch. In reality, the superproject records a specific commit SHA for each submodule. Branches only matter when you choose to update.

This pinning is what makes submodule-based builds reproducible across machines and time.

Inspecting the Pinned Commit

See exactly which commit each submodule is locked to with git submodule status. The leading SHA is the recorded pin.

git submodule status
# +a1b2c3d libs/engine (v2.3.0-4-ga1b2c3d)

Reading the Status Prefix

  • (space) — submodule is at the pinned commit
  • + — checked-out commit differs from the pin
  • - — submodule is not initialized
  • U — merge conflicts in the submodule

Pinning to a Specific Tag

To pin to a released tag, enter the submodule, check out the tag, then commit the new pointer in the superproject.

cd libs/engine
git fetch --tags
git checkout v2.4.0
cd ../..
git add libs/engine
git commit -m 'Pin engine to v2.4.0'

Pinning to an Exact SHA

Sometimes you need a commit between releases. Check out the exact SHA inside the submodule, then record it in the superproject.

cd libs/engine
git checkout 9f8e7d6
cd ../..
git add libs/engine
git commit -m 'Pin engine to 9f8e7d6 hotfix'

Detached HEAD Is Normal Here

Checking out a tag or SHA puts the submodule in detached HEAD. That is expected and correct for pinning. You only attach to a branch when you intend to develop inside the submodule.

Optional Branch Tracking

You can record a preferred branch in .gitmodules so git submodule update --remote knows what to follow. The pin still wins until you explicitly update.

[submodule "libs/engine"]
  path = libs/engine
  url = https://example.com/engine.git
  branch = stable

Controlled Updates with --remote

To advance a submodule to the latest of its tracked branch, use --remote. Review the diff before committing the new pin so the bump is deliberate.

git submodule update --remote libs/engine
git diff --submodule
git add libs/engine && git commit -m 'Bump engine'

Enforcing Pins in CI

Builds should fail if a submodule drifts from its pin. A CI guard checks that the checked-out SHA matches the recorded one.

git submodule status | grep '^+' && echo 'Submodule drift!' && exit 1

Why Deliberate Pinning Matters

Accidental submodule bumps are a frequent source of mysterious build breaks. Treating each pin change as a reviewable, intentional commit keeps your dependency surface predictable and auditable.

Reverting a Bad Pin

If a pin update breaks the build, revert it like any other change: the superproject commit that moved the pointer can be undone, snapping the submodule back to its previous SHA.

git revert <pin-bump-commit>
git submodule update --init libs/engine

Quick Check

Test your understanding of submodule pinning.

Recap

You learned that submodules pin commit SHAs, how to read git submodule status prefixes, how to pin to a tag or exact SHA, why detached HEAD is normal, optional branch tracking, controlled --remote updates, and CI drift enforcement. Deliberate pinning keeps advanced submodule setups reproducible.

Sıkça Sorulan Sorular

“Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme” dersi ücretsiz mi?

Evet — “Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Git Advanced: Monorepo, Submodules & Workflows kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Git Advanced: Monorepo, Submodules & Workflows kursu toplamda 4 dersten oluşur.

“Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme” dersinde ne öğreneceğim?

İleri düzey iş akışlarında yeniden üretilebilir derlemeler ve bilinçli, incelenebilir bağımlılık güncellemeleri sağlamak için bir alt modülün tam olarak hangi commit'e veya etikete işaret ettiğini de… Git Advanced: Monorepo, Submodules & Workflows ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Git Advanced: Monorepo, Submodules & Workflows öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Git Advanced: Monorepo, Submodules & Workflows, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Git Advanced: Monorepo, Submodules & Workflows dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Git Advanced: Monorepo, Submodules & Workflows dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Alt Modül Dallarıyla Çalışma
  2. İç İçe Alt Modüller ve Karmaşık Kurulumlar
  3. Yaygın Alt Modül Sorunları ve Çözümleri
  4. Alt Modülleri Belirli Etiketlere ve Commit'lere Sabitleme
← Git Advanced: Monorepo, Submodules & Workflows Sayfasına Dön