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

Alt Modül Dallarıyla Çalışma

Bir alt modül içindeki dalları yönetmeyi ve değiştirmeyi, ardından değişiklikleri alt modülün kaynağına göndermeyi öğrenin.

Alt Modül Dallarıyla Çalışma, CoddyKit'te ücretsiz bir Git Advanced: Monorepo, Submodules & Workflows dersidir. Bu, 4 dersinin 1. 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.

Branching in Submodules

Git submodules usually point to a specific commit. But what if you need to actively develop inside a submodule?

  • This allows independent feature development.
  • You can contribute changes back to the submodule's own project.
  • It's key for complex projects needing tight integration.

Submodules: Detached HEAD

By default, when you clone a project with submodules, each submodule is checked out to a specific commit. This is called a "detached HEAD" state.

  • It means you're not currently on any named branch.
  • You can view files, but new commits won't automatically belong to a branch.
  • It provides a stable way for the parent repo to reference specific submodule versions.

Navigating into a Submodule

To work with a submodule's branches, you first need to navigate into its directory. Think of it as entering a completely separate Git repository.

Use the cd command to change directories:

# Assume 'my-submodule' is a submodule
cd my-submodule
git status

Checking Submodule Status

Once inside the submodule's directory, you can use regular Git commands to see its status, branches, and current HEAD. This helps you understand its current state.

# Inside the submodule directory
git status
git branch
git log --oneline -1

Switching Submodule Branches

To develop within a submodule, you need to switch from a detached HEAD to a specific branch. Use git checkout just like in any other Git repository.

# Inside the submodule directory
git checkout main
# Or to create and switch to a new branch
git checkout -b new-feature

Committing in a Submodule

Now that you're on a branch, you can make changes, add them, and commit them. These commits are specific to the submodule's repository, not the parent repository.

# Inside the submodule directory
echo "New content" > newfile.txt
git add newfile.txt
git commit -m "Added newfile in submodule"

Pushing Submodule Changes

After committing changes within the submodule, you need to push them to the submodule's own remote repository. This makes your changes available to others.

# Inside the submodule directory
git push origin main
# Or to push a new branch
git push origin new-feature

Updating the Parent Repository

After pushing changes in the submodule, the parent repository still points to the old commit. You need to tell the parent repo to track the new commit.

  • Navigate back to the parent repository.
  • Stage and commit the submodule's change.
# Back in the parent repository
cd .. # Go up one level
git status
git add my-submodule
git commit -m "Updated my-submodule to latest commit"
git push origin main

Submodule Branching Tips

Working with submodule branches requires care and coordination:

  • Communicate: Inform your team if you're actively developing on a submodule branch.
  • Keep parent updated: Always commit the submodule reference change in the parent repo after pushing submodule changes.
  • Avoid direct pushes: Don't push to a submodule's main branch from the parent repo unless absolutely necessary; work inside the submodule itself.

Submodule Branch Quiz

Test your knowledge on managing submodule branches!

Recap: Submodule Branches

In this lesson, we explored how to actively develop within a Git submodule:

  • Navigating into the submodule's directory.
  • Switching from a detached HEAD to a specific branch.
  • Making, committing, and pushing changes in the submodule.
  • Updating the parent repository's reference to the new submodule commit.

This workflow enables independent development and contribution to submodule projects, making your overall project more flexible.

Sıkça Sorulan Sorular

“Alt Modül Dallarıyla Çalışma” dersi ücretsiz mi?

Evet — “Alt Modül Dallarıyla Çalışma” 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ül Dallarıyla Çalışma” dersinde ne öğreneceğim?

Bir alt modül içindeki dalları yönetmeyi ve değiştirmeyi, ardından değişiklikleri alt modülün kaynağına göndermeyi öğrenin. 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 1. dersidir.

“Alt Modül Dallarıyla Çalışma” 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