GITHUB-FOUNDATIONS practice question 15 of 15

What are three valid states for a file in a git repository? (Each correct answer presents part of the solution. Choose three.)

Full set: 75 questions
Answer options
A: Committed Correct answer
B: Modified Correct answer
C: Uncommitted
D: Staged Correct answer
E: Tracked
Correct Answer:
A. Committed; B. Modified; D. Staged
Explanation

Git recognizes three primary states for any file in a repository lifecycle.
1. Modified – the file has been changed in the working directory but those changes are not yet staged.
2. Staged – the changed file has been added to the index and will become part of the next commit.
3. Committed – the file’s current snapshot has been safely recorded in the local repository history. These three states are explicitly identified in Git’s official documentation and form the core of its change-tracking model.

Why Incorrect

C. Uncommitted – Not an official Git state; simply an informal English description of “not yet committed.”
E. Tracked – Describes whether Git follows a file (tracked vs. untracked); not counted among the three file states (modified, staged, committed).

References

1. Chacon, S., Straub, B. “Pro Git,” 2nd ed., Apress, 2014, Chapter 1.2 “The Three States,” 1st–3rd paragraphs. https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

2. Git Community Docs, “git-add(1) Manual,” SYNOPSIS & DESCRIPTION sections: clarifies moving files to “staged” state. https://git-scm.com/docs/git-add

3. Git Community Docs, “git-commit(1) Manual,” DESCRIPTION section: defines “committed” objects stored in repository history. https://git-scm.com/docs/git-commit

Scroll to Top