CodeBlanks Logo Icon CodeBlanks

File states

Learn the untracked, modified and staged states.

Understand Untracked Files

New files that Git does not track yet are in the untracked state. These files are not included in a commit automatically; they must be staged first.

git status
Untracked files: new.txt

Modified and Staged States

When a tracked file changes from its recorded version, it becomes modified. When you stage that change with git add, it enters the staged state.

git add app.js
git status

Practice Create Text Describing File States

Store descriptions of three file states in an object. Use untracked for newFile, modified for editedFile, and staged for readyFile. Print the values on separate lines.

Starter code

terminal
// Dosya durumlarını tanımla
let fileStates = {};

// Durumları ekrana yazdır

Sample solution

terminal
let fileStates = {
  newFile: 'untracked',
  editedFile: 'modified',
  readyFile: 'staged'
};

console.log(fileStates.newFile);
console.log(fileStates.editedFile);
console.log(fileStates.readyFile);

Expected output

untracked
modified
staged

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 new file that Git does not track yet?

  • modified
  • committed
  • staged
  • untracked Correct answer

Explanation: <code>untracked</code> is the state used for files Git does not track yet.

2 Complete the Modified File State

Question
Takip edilen bir dosyada henüz sahneye alınmamış değişiklik varsa dosya ____ durumundadır.
Answer
Takip edilen bir dosyada henüz sahneye alınmamış değişiklik varsa dosya modified durumundadır.

Explanation: <code>modified</code> indicates that a tracked file has changed but has not yet been staged.

3 Match the File States

Term Meaning
untracked Not tracked by Git
modified Tracked file has changed
staged Prepared for commit
git add Stage the change

All lessons in Beginner