200-901 · Question #152
A developer needs to prepare the file README.md in the working tree for the next commit operation using Git. Which command needs to be used to accomplish this?
The correct answer is C. git add README.md. The correct answer is C. 'Preparing a file for the next commit' means staging it-adding it to Git's staging area (index). The correct command is 'git add README.md'. This moves the file from the working tree to the staging area, where it awaits the next 'git commit'. Answer A…
Question
A developer needs to prepare the file README.md in the working tree for the next commit operation using Git. Which command needs to be used to accomplish this?
Options
- Agit add README.md staging
- Bgit -a README.md
- Cgit add README.md
- Dgit commit README.md
How the community answered
(15 responses)- A7% (1)
- C87% (13)
- D7% (1)
Explanation
The correct answer is C. 'Preparing a file for the next commit' means staging it-adding it to Git's staging area (index). The correct command is 'git add README.md'. This moves the file from the working tree to the staging area, where it awaits the next 'git commit'. Answer A is incorrect because 'git add README.md staging' is not valid Git syntax; 'staging' is not a valid argument here. Answer B is incorrect because 'git -a' is not a valid standalone command; '-a' is a flag used with 'git commit' to auto-stage tracked files. Answer D is incorrect because 'git commit README.md' would attempt to commit without first staging, and bypasses the standard workflow.
Topics
Community Discussion
No community discussion yet for this question.