Bird
0
0

Given this sequence of commands, what is the output of git status after step 4?

medium📝 Command Output Q13 of 15
Git - Collaboration Workflows
Given this sequence of commands, what is the output of git status after step 4?
1. git checkout -b feature
2. touch newfile.txt
3. git add newfile.txt
4. git status
AOn branch feature Changes to be committed: (new file: newfile.txt)
BOn branch feature nothing to commit, working tree clean
COn branch main Changes to be committed: (new file: newfile.txt)
Dfatal: not a git repository
Step-by-Step Solution
Solution:
  1. Step 1: Analyze branch and file status

    After 'git checkout -b feature', you are on 'feature' branch. 'touch newfile.txt' creates a new file. 'git add newfile.txt' stages it.
  2. Step 2: Understand git status output

    'git status' shows staged changes. Since newfile.txt is added, it appears under 'Changes to be committed' on branch 'feature'.
  3. Final Answer:

    On branch feature Changes to be committed: (new file: newfile.txt) -> Option A
  4. Quick Check:

    Added file staged = git status shows it [OK]
Quick Trick: Staged files show under 'Changes to be committed' in git status [OK]
Common Mistakes:
  • Assuming branch is still main
  • Thinking staging clears changes
  • Confusing untracked with staged files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes