0
0
Gitdevops~20 mins

git status to see current state - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Status Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of git status after modifying a tracked file?
You have a tracked file named app.py. You edit it but do not stage the changes. What will git status show?
AOn branch main\nChanges not staged for commit:\n (use "git add <file>..." to update what will be committed)\n (use "git restore <file>..." to discard changes in working directory)\n\n\tmodified: app.py\n\nno changes added to commit (use "git add" and/or "git commit -a")
Bfatal: not a git repository (or any of the parent directories): .git
COn branch main\nnothing to commit, working tree clean
DOn branch main\nUntracked files:\n (use "git add <file>..." to include in what will be committed)\n\n\tapp.py\n\nnothing added to commit but untracked files present (use "git add" to track)
Attempts:
2 left
💡 Hint
Think about what happens when you change a file but don't stage it.
💻 Command Output
intermediate
2:00remaining
What does git status show after staging a new file?
You create a new file README.md and run git add README.md. What will git status display?
AOn branch main\nUntracked files:\n (use "git add <file>..." to include in what will be committed)\n\n\tREADME.md
BOn branch main\nnothing to commit, working tree clean
COn branch main\nChanges to be committed:\n (use "git restore --staged <file>..." to unstage)\n\n\tnew file: README.md
Dfatal: pathspec 'README.md' did not match any files
Attempts:
2 left
💡 Hint
What does staging a file do to its status?
Troubleshoot
advanced
2:00remaining
Why does git status show 'fatal: not a git repository'?
You run git status inside a folder but get the error: fatal: not a git repository (or any of the parent directories): .git. What is the most likely cause?
AYou have uncommitted changes in the repository.
BYou have staged files but not committed them yet.
CYour remote repository URL is incorrect.
DYou are not inside a folder initialized as a git repository (no .git folder present).
Attempts:
2 left
💡 Hint
Think about what makes a folder a git repository.
Best Practice
advanced
2:00remaining
Which git status output indicates a clean working directory ready for a new commit?
You want to confirm your working directory has no changes before starting new work. Which git status output shows this?
AOn branch main\nnothing to commit, working tree clean
BOn branch main\nChanges not staged for commit:\n modified: index.html
COn branch main\nChanges to be committed:\n new file: script.js
DOn branch main\nUntracked files:\n README.md
Attempts:
2 left
💡 Hint
Look for the message that says there are no changes.
🔀 Workflow
expert
3:00remaining
What sequence of git status outputs occurs when you modify, stage, and then unstage a file?
You modify app.js, stage it, then unstage it using git restore --staged app.js. What is the correct order of git status outputs after each step?
A3,2,1
B1,2,3
C1,3,2
D2,1,3
Attempts:
2 left
💡 Hint
Think about how staging and unstaging affect the file's status.