Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to show the current branch where HEAD is pointing.
Git
git [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git status' which shows changes but not the branch list.
Using 'git commit' which creates a commit, not shows branches.
✗ Incorrect
The git branch command lists branches and highlights the current branch where HEAD points.
2fill in blank
mediumComplete the command to move HEAD to a specific commit hash.
Git
git checkout [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a branch name instead of a commit hash when wanting detached HEAD.
Using remote or tag names which are not commit hashes.
✗ Incorrect
The git checkout command with a commit hash moves HEAD to that commit in detached mode.
3fill in blank
hardFix the error in the command to reset HEAD to the previous commit.
Git
git reset [1] HEAD~1
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using --hard which discards changes.
Using --merge or --keep which are for other reset behaviors.
✗ Incorrect
The --soft option moves HEAD to the previous commit but keeps changes staged.
4fill in blank
hardFill both blanks to create a new branch and move HEAD to it.
Git
git [1] -b [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git branch -b' which is invalid syntax.
Using 'master' as the new branch name when the task expects 'new-feature'.
✗ Incorrect
The command git checkout -b new-feature creates and switches HEAD to the new branch.
5fill in blank
hardFill all three blanks to show the commit where HEAD currently points.
Git
git [1] -[2] 1 [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git branch' which lists branches, not commits.
Omitting the '-n' option to limit commits.
✗ Incorrect
The command git log -n 1 HEAD shows the latest commit where HEAD points.