Git Working Tree (original) (raw)

Last Updated : 23 Mar, 2026

The working tree in Git includes all project files outside the .git folder and represents the current state of your project where changes are made and tracked.

Working Tree and git status

Remote repositories (like Github) do not have a working tree. However, in a local repository, we can analyze the working tree using:

git status

This command helps us understand the current state of files in the working directory.

Example: Understanding Working Tree

1. Initialize Repository

Create an empty directory and Initialize Git:

git init

The .git folder is created (not part of the working tree)

2. Add a new file

Create a file named demo.txt and then run:

git status

3. Add to Staging Area

Stage the file:

git add demo.txt

Check status again:

git status

4. Commit the File

Commit Changes:

git commit -m "Created demo.txt"

Check status again:

git status

5. Modify the File

Edit demo.txt and run:

git status

6. Stage and Commit Changes

git add demo.txt
git commit -m "Update demo.txt"

7. Delete the file

Delete demo.txt and run:

git status

8. Stage and Commit Deletion

git add demo.txt
git commit -m "Deleted demo.txt"