Git & GitHub Interview Question #18

What is an untracked file in Git?

Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner

Quick Interview Answer

An untracked file exists in the working tree but is not currently tracked by Git. Git reports it in git status until it is staged and committed or intentionally ignored.

Detailed Explanation

An untracked file exists in the working tree but is not currently tracked by Git. Git reports it in git status until it is staged and committed or intentionally ignored.

A file becomes tracked after Git begins recording it, normally when it is added and committed. Build outputs, secrets, temporary files, and local settings are often excluded through .gitignore when appropriate.

Code Example

git status
git add new-file.cs