Open In App

Git - Working Tree

Last Updated : 09 Oct, 2025
Comments
Improve
Suggest changes
2 Likes
Like
Report

The working tree in Git consists of all the files and folders in your project outside the .git folder. It represents the current state of your project on your local system. Any modifications, additions, or deletions you make are tracked here. You can view these changes using git status. Unlike local repositories, remote repositories (like GitHub) do not have a working tree; they only store commits.

  • Files and folders outside .git belong to the working tree
  • .git folder is not part of the working tree
  • Tracks changes made to files (modified, added, deleted)
  • Changes can be viewed with git status
  • Serves as a bridge between local edits and the staging area
  • Remote repositories do not have a working tree

The repositories on Github, however, don't have a working tree. However, on the local repository, we can get a good overview of the working tree. The command that helps us to get insight into the mechanics of the working tree is as follows:

git status

Let us look at an example, we will create an empty directory and initialize it to a git repository using git init command.

As discussed above the .git folder is not part of the working tree, the files that we would be adding to the directory now will become part of Working Tree.

Let's add a new file demo.txt to our directory and then check our working tree using the command git status.

We can see there is some message given to us by the git status command, which states that there is a file called demo.txt which is there in our working tree which is currently being untracked.

Let's add our file to the staging area and let's observe the git status command.

Our file is now added to the staging area but we again got a message saying that we have not added commit. Let's add commit using git commit command and check our working tree status.

Now we got a message that there is nothing to commit and the working tree is clean. Let's modify our demo.txt and then again observe our working tree. 

As soon as we modified our demo.txt our working tree informs us that there is a change in the working directory. Let's add these changes to the staging area and commit these changes.

So again, our working tree now becomes clean. Now, let's observe what happens if we delete our file, will the working tree show those changes?

And we can see that after deleting our file, we get the message that there is a change that is untracked. So, let's add those changes to the staging area and commit them.

So again our working tree becomes clean, let us look at the commits that we have had till now. So, in a similar manner, one can try on more examples to get a better understanding of the working tree.

Suggested Quiz
5 Questions

What is the working tree in Git?

  • A

    Only the .git folder

  • B

    The remote version of the repository

  • C

    All project files outside .git representing the current state

  • D

    Files already committed to the remote repository

Explanation:

The working tree contains all files and directories in the project except .git, reflecting the current editable state.

Which command is used to view changes in the working tree?

  • A

    git log

  • B

    git status

  • C

    git init

  • D

    git branch

Explanation:

git status shows which files are modified, untracked, staged, or committed, helping track working tree status.

Do remote repositories like GitHub have a working tree?

  • A

    Yes, same as local

  • B

    Only when modified

  • C

    No, they store only commit history

  • D

    Only if enabled manually

Explanation:

Remote repositories store commits only, not a working tree. Working trees exist only in local repositories.

When a file is modified and not staged, how does the working tree reflect it?

  • A

    Shows as committed

  • B

    Shows as clean

  • C

    Shows modified/untracked using git status

  • D

    Deletes the file automatically

Explanation:

Unstaged modifications appear in working tree status as modified/untracked changes.

When the working tree displays “nothing to commit, working tree clean”, what does it mean?

  • A

    There are untracked files

  • B

    All changes are committed and no pending modifications

  • C

    The repository is deleted

  • D

    Staging area is corrupted

Explanation:

It means there are no unstaged or uncommitted changes — both working tree and staging area are clean.

Quiz Completed Successfully
Your Score :   2/5
Accuracy :  0%
Login to View Explanation
1/5 1/5 < Previous Next >

Article Tags :

Explore