0
0
Gitdevops~5 mins

Submodules vs subtrees comparison in Git - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is a Git submodule?
A Git submodule is a way to include one Git repository inside another as a separate folder. It keeps the external repo at a specific commit, allowing you to track it independently.
Click to reveal answer
beginner
What is a Git subtree?
A Git subtree lets you merge another repository into a subdirectory of your repo. It copies the external repo's files and history, making it part of your main repo.
Click to reveal answer
intermediate
How do submodules handle updates from the external repository?
Submodules require manual updating by running commands to fetch and checkout new commits in the submodule folder. They do not update automatically with the main repo.
Click to reveal answer
intermediate
What is a key advantage of using Git subtrees over submodules?
Subtrees integrate the external repo fully into your main repo, so you don't need extra commands to clone or update. This makes it simpler for users who clone your repo.
Click to reveal answer
intermediate
Name one challenge when using Git submodules.
One challenge is that submodules add complexity because users must remember to initialize and update them separately, which can cause confusion or errors if forgotten.
Click to reveal answer
Which Git feature keeps an external repository as a separate folder linked to a specific commit?
ASubtree
BSubmodule
CBranch
DTag
Which method fully integrates the external repository's files and history into your main repository?
ASubmodule
BFork
CSubtree
DClone
What must you do after cloning a repository that uses submodules to get the submodule content?
ANothing, submodules clone automatically
BRun 'git subtree pull'
CRun 'git fetch origin'
DRun 'git submodule update --init'
Which approach can cause confusion because it requires extra commands to keep external code updated?
ASubmodule
BBranch
CFork
DSubtree
Which Git feature is simpler for users cloning the repo because it does not require extra commands to get external code?
ASubtree
BSubmodule
CTag
DBranch
Explain the main differences between Git submodules and Git subtrees.
Think about how each method handles external code and updates.
You got /4 concepts.
    Describe a scenario where using Git submodules might be better than subtrees.
    Consider control and separation of external code.
    You got /4 concepts.