0
0
Gitdevops~10 mins

Detached HEAD state in Git - Interactive Code Practice

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

Complete the phrase from `git status` output indicating detached HEAD state.

Git
HEAD detached at [1]
Drag options to blanks, or click blank then click option'
Amaster
Btag
Cbranch
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'master' or 'branch' which are branch names, not commit references.
Confusing 'tag' with commit in detached HEAD context.
2fill in blank
medium

Complete the command to create a new branch from the current detached HEAD state.

Git
git checkout -b [1]
Drag options to blanks, or click blank then click option'
Anew-branch
BHEAD
Cmaster
Dorigin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'HEAD' as branch name which is invalid.
Trying to checkout 'master' which switches to an existing branch.
3fill in blank
hard

Fix the error in the command to return to the main branch from a detached HEAD state.

Git
git checkout [1]
Drag options to blanks, or click blank then click option'
Acommit
Bmain
Cdetached
DHEAD
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'HEAD' which keeps you in detached state.
Using 'commit' which is not a branch.
4fill in blank
hard

Fill both blanks to create a new branch and switch to it from a detached HEAD.

Git
git [1] -b [2]
Drag options to blanks, or click blank then click option'
Acheckout
Bcommit
Cnew-branch
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit' or 'reset' as commands which do not create branches.
Using 'commit' as branch name which is invalid.
5fill in blank
hard

Fill all three blanks to discard changes and return to the main branch from detached HEAD.

Git
git [1] --hard [2] && git [3] main
Drag options to blanks, or click blank then click option'
Areset
BHEAD
Ccheckout
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit' instead of 'checkout' to switch branches.
Using 'commit' instead of 'HEAD' in reset command.