200-901 · Question #267
A file that already exists in a local repository is updated. Which command must be executed to ensure that the changes in the file are included in the next Git commit?
The correct answer is C. git add. git add stages file changes so they are included in the next commit. Even for files already tracked by Git, modifications must be explicitly staged with git add <filename> (or git add .) before running git commit. Without this step, the changes remain in the working directory…
Question
A file that already exists in a local repository is updated. Which command must be executed to ensure that the changes in the file are included in the next Git commit?
Options
- Agit update
- Bgit merge
- Cgit add
- Dgit rebase
How the community answered
(52 responses)- A2% (1)
- B6% (3)
- C88% (46)
- D4% (2)
Explanation
git add stages file changes so they are included in the next commit. Even for files already tracked by Git, modifications must be explicitly staged with git add <filename> (or git add .) before running git commit. Without this step, the changes remain in the working directory but are not committed. git update is not a valid Git command. git merge integrates branches, not individual file changes. git rebase replays commits onto another base branch - it does not stage files.
Topics
Community Discussion
No community discussion yet for this question.