0
0
Gitdevops~10 mins

Working in multiple branches simultaneously in Git - Interactive Code Practice

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

Complete the command to switch to an existing branch named 'feature'.

Git
git [1] feature
Drag options to blanks, or click blank then click option'
Acheckout
Bcommit
Cmerge
Dpush
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git commit' instead of 'git checkout'.
Trying to use 'git push' to switch branches.
2fill in blank
medium

Complete the command to create and switch to a new branch named 'bugfix'.

Git
git [1] -b bugfix
Drag options to blanks, or click blank then click option'
Amerge
Bbranch
Ccheckout
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git branch' alone does not switch branches.
Using 'git merge' to create branches.
3fill in blank
hard

Fix the error in the command to list all branches including remote ones.

Git
git [1] -a
Drag options to blanks, or click blank then click option'
Abranch
Bstatus
Ccheckout
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git checkout -a' which is invalid.
Using 'git status -a' which does not list branches.
4fill in blank
hard

Fill both blanks to create a new branch 'release' and push it to the remote repository.

Git
git [1] -b release && git [2] -u origin release
Drag options to blanks, or click blank then click option'
Acheckout
Bpush
Ccommit
Dmerge
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git commit' instead of 'git push' to upload branch.
Using 'git merge' incorrectly here.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps branch names to their last commit hash, filtering only branches starting with 'feature'.

Git
{branch[1]: commits[branch] for branch in branches if branch[2]('feature') and commits[branch][3] ''}
Drag options to blanks, or click blank then click option'
A.upper()
B.startswith(
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '!=' to check non-empty commits.
Not using '.startswith(' to filter branches.