Challenge - 5 Problems
Git Add Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of staging a single file?
You run the command
git add README.md in a repository. What is the immediate output shown by Git?Attempts:
2 left
💡 Hint
Think about what Git normally shows when you add files.
✗ Incorrect
By default, git add does not produce any output when it stages files successfully. It silently updates the staging area.
💻 Command Output
intermediate1:30remaining
What happens when you stage all files with a wildcard?
You run
git add *.txt in a directory with files: notes.txt, todo.txt, and image.png. What files get staged?Attempts:
2 left
💡 Hint
Consider how shell wildcards work before Git sees the command.
✗ Incorrect
The shell expands *.txt to all files ending with .txt before Git runs. So only notes.txt and todo.txt are staged.
❓ Configuration
advanced2:00remaining
Which command stages all modified and deleted files but not new untracked files?
You want to stage all changes except new untracked files. Which command achieves this?
Attempts:
2 left
💡 Hint
Look at the difference between -u and -A options.
✗ Incorrect
git add -u stages modified and deleted files but ignores new untracked files. git add -A and git add --all stage all changes including new files.
❓ Troubleshoot
advanced2:00remaining
Why does
git add fail with 'fatal: pathspec ... did not match any files'?You run
git add docs/*.md but get the error: 'fatal: pathspec 'docs/*.md' did not match any files'. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if the files actually exist in the specified path.
✗ Incorrect
The error means the shell did not expand the wildcard because no matching files exist. Git received the literal pattern and could not find files matching it.
✅ Best Practice
expert2:30remaining
Which command safely stages only parts of a file interactively?
You want to stage only some changes inside a file, not the whole file. Which command lets you do this interactively?
Attempts:
2 left
💡 Hint
Look for the option that allows patch mode.
✗ Incorrect
git add -p lets you review changes chunk by chunk and choose which to stage. Other options stage whole files or all changes.