CS FundamentalsModerateTCS · Accenture · Git interview

A developer edits a tracked file app.py, creates a new file util.py, and runs git commit -a -m "update". What is committed?

  1. A. Both app.py and util.py
  2. B. Only util.py
  3. C. Only the changes to app.py; the new, untracked util.py is not included
  4. D. Nothing, because -a needs git add first

Correct answer: C. Only the changes to app.py; the new, untracked util.py is not included

-a automatically stages modifications and deletions of tracked files only. Untracked files must be added explicitly with git add.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic