CodeBlanks Logo Icon CodeBlanks

Untracked

Learn the untracked file state.

What is an untracked file?

A newly created file is in the untracked state if Git is not tracking it yet. The file exists in the working directory but is not part of the commit history. Git can detect this file and show it as untracked in the status information.

# Create a new file
index.html

You can add the file to the staging area to start tracking it.

Start tracking a new file

Use the git add command to make Git track an untracked file. The command stages the file and prepares it for the next commit. For example, git add notes.txt stages only the specified file.

git add notes.txt
git status

Once staged, the file becomes part of the tracking process.

Practice Stage a new file

Write the command that adds the new file named report.txt to Git's staging area.

Starter code

terminal
# Yeni dosyayı sahneye ekle

Sample solution

terminal
# Yeni dosyayı sahneye ekle
git add report.txt

Expected output

git add report.txt

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What is the state of a newly created file that you have not added to Git yet?

  • Tracked
  • Untracked Correct answer
  • Modified
  • Committed

Explanation: The file is untracked because it has not been staged or committed yet.

2 Stage a new file

Question
git add ____
Answer
git add notes.txt

Explanation: The <code>git add notes.txt</code> command stages the new file.

3 The first steps of a new file

Term Meaning
Untracked Not tracked yet
New file A newly created file
git add Stages the file
Staging Preparation area before a commit

All lessons in Beginner