0
0
Gitdevops~10 mins

Submodules vs subtrees comparison in Git - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to add a Git submodule.

Git
git submodule [1] https://github.com/example/lib.git
Drag options to blanks, or click blank then click option'
Aadd
Bclone
Cinit
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'clone' instead of 'add' causes an error.
Using 'init' only initializes existing submodules.
2fill in blank
medium

Complete the command to pull changes for all submodules.

Git
git submodule [1] --recursive
Drag options to blanks, or click blank then click option'
Aclone
Badd
Cinit
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'init' only initializes submodules but does not update them.
Using 'clone' is not valid here.
3fill in blank
hard

Fix the error in the command to add a subtree at prefix 'lib'.

Git
git subtree [1] --prefix=lib https://github.com/example/lib.git main
Drag options to blanks, or click blank then click option'
Aclone
Bpull
Cadd
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pull' instead of 'add' causes errors.
Using 'clone' is not a valid subtree command.
4fill in blank
hard

Fill both blanks to complete the command that updates a subtree from remote 'origin' branch 'main'.

Git
git subtree [1] --prefix=lib [2] main
Drag options to blanks, or click blank then click option'
Apull
Bpush
Corigin
Dadd
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping pull and push causes wrong behavior.
Using 'add' instead of 'pull' does not update the subtree.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps submodule names to their paths if they are initialized.

Git
{ [1]: [2] for [3] in submodules if submodules[[3]]['initialized'] }
Drag options to blanks, or click blank then click option'
Aname
Bsubmodules[name]['path']
Dsubmodules
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable name causes errors.
Not filtering initialized submodules includes unwanted entries.