Lesson 05 of 10Concept

Working Tree

Goal: Understand the working tree and the states a file can be in.

The files you can see

The working tree is your project folder as it is right now: the files you open, edit, create and delete in your editor.

Git constantly compares the working tree with the last commit. Every difference shows up in git status, and nothing is recorded until you decide to commit it.

File states

  • Unmodified: the file is exactly as it was in the last commit.
  • Modified: a tracked file has been edited since the last commit.
  • Deleted: a tracked file has been removed from the folder.
  • Untracked: a new file Git has never recorded. Git ignores it until you add it.

Watch the working tree change

Step 1 of 5

Working Tree

  • README.mdCommitted
  • index.jsCommitted

Staging Area

Empty

Repository

  • README.md
  • index.js

Right after a commit, every file matches the repository. The working tree is clean.

Step 1 of 5. Right after a commit, every file matches the repository. The working tree is **clean**.

The same working tree in git status

$ git status

On branch main
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
	deleted:    README.md
	modified:   index.js

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	login.js

Finished reading?

Marking it complete records your progress and XP for this lesson.