Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a file to the staging area.
Git
git add [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit' instead of a filename.
Trying to add a command like 'push' instead of a file.
✗ Incorrect
The git add command adds the specified file to the staging area (index), preparing it for commit.
2fill in blank
mediumComplete the command to see the current status of the staging area.
Git
git [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit' instead of 'status'.
Using 'push' which sends changes to remote, not shows status.
✗ Incorrect
The git status command shows which files are staged, unstaged, or untracked.
3fill in blank
hardFix the error in the command to commit staged changes with a message.
Git
git commit -m [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes causes git to treat each word as separate arguments.
Using single quotes may work in some shells but double quotes are safer.
✗ Incorrect
The commit message must be enclosed in quotes to be treated as a single string.
4fill in blank
hardFill both blanks to switch to the new-feature branch.
Git
git [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'branch' instead of 'checkout' to switch branches.
Using 'commit' which is unrelated here.
✗ Incorrect
git checkout new-feature switches to the branch named 'new-feature'.
5fill in blank
hardFill all three blanks to stage all changes, commit with a message, and push to remote.
Git
git [1] . && git commit -m [2] && git [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to stage files before committing.
Not quoting the commit message.
Using 'status' instead of 'push' to send changes.
✗ Incorrect
This sequence stages all changes, commits them with a message, and pushes to the remote repository.