CodeBlanks Logo Icon CodeBlanks

Summary - Status

Combine the status output to explain the file lifecycle.

The Git File Status Lifecycle

A new file starts as untracked. When a tracked file is changed, it becomes modified; when the change is staged, it enters the staged state.

untracked → staged
modified → staged

Practice Build a File Status Flow

Put the stages of a new file being staged and saved into an array. Use untracked, staged, and committed in that order. Then print each state on a separate line.

Starter code

terminal
// Dosya yaşam döngüsünü tanımla
let lifecycle = [];

// Durumları ekrana yazdır

Sample solution

terminal
let lifecycle = ['untracked', 'staged', 'committed'];

lifecycle.forEach(state => console.log(state));

Expected output

untracked
staged
committed

Questions and answers

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

1 Which command do you use to prepare a tracked file for commit after modifying it?

  • git config
  • git add Correct answer
  • git status -s
  • git commit

Explanation: <code>git add</code> stages the modified file and prepares it for a commit.

2 Complete the Next File State

Question
Bir dosya değiştirildikten sonra ____ komutuyla sahneye alınır.
Answer
Bir dosya değiştirildikten sonra git add komutuyla sahneye alınır.

Explanation: <code>git add</code> stages the modified file.

3 Match the File Lifecycle

Term Meaning
untracked File not tracked yet
modified Tracked file with changes
staged File prepared for commit
git status Show file states

All lessons in Beginner