What is the working directory?
The working directory is the current state of the project's files on disk that the developer works with.
This is:
- the files you see in the project folder
- the code that opens in the editor
- the place where you make changes manually
The working directory contains:
- unchanged files
- changed files that are not yet added to the staging area
- new (untracked) files
The working directory differs from:
- the staging area (index) - changes prepared for a commit
- the repository (history) - already saved commits
Relationship between states:
- changes first land in the working directory
- then get added to the staging area
- after a commit they are saved to the history
A key phrasing for an interview:
The working directory is the working copy of the project where all changes happen before they get added to the staging area and committed.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.