Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git relies on the basis of distributed development of software where more than one developer may have access to the source code of a specific application and can modify changes to it that may be seen by other developers. Initially designed and developed by Linus Torvalds for Linux kernel development in 2005.
When we work with Git we mainly deal with the files and folders but one should not just relate Git with this, but Git provides us just more than that with Git Working Tree being one of them.
Working Tree
When we have our project files ready locally, we initialize the project directory with git init command to make it a local git repository. After initializing our directory with the git init command we can see .git folder which gets added to our directory. All the files and folders that we add to the Git repository residing outside the .git folder are known as the Git working tree. However, the .git folder is not a part of the working tree. This working tree tracks the files, folders, and the changes that we make inside them.
For example, If we modify the content of our file, the working tree takes a note of it and we get the information of it through the git status command. Similarly, we can inspect the files that are being edited and not added to the staging area.
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.

Similar Reads
Git | Working with Stash
Pre-requisites: Git Git allows multiple users to work on the same project simultaneously. Suppose a developer is working on a feature in a branch and he needs to pull changes from some other developer's branch or if he has to work urgently on some other feature, but the feature he is currently worki
8 min read
Working With Git Repositories
Git is a powerful and widely-used version control system that helps developers manage their codebases efficiently. By using Git repositories, developers can track changes, collaborate with others, and maintain a history of their projectâs development. In this article, we will learn about working wit
7 min read
Git - Origin Master
Git is a popular version control system used by developers to manage and track changes in their code. Among the many concepts in Git, git origin master is fundamental, especially for those who are new to Git or looking to understand best practices for managing repositories. In this article, weâll br
4 min read
Working on Git for GUI
Git has its native environment within the terminal. All the new features are updated first at the command line, and only there is the full power of Git. But plain text isn't the simplest choice for all tasks; sometimes some users are much more comfortable with a point-and-click interface, a visual r
4 min read
Undoing in Git
Undoing in Git means doing undo just like when we type something in any text editor and delete the same. After that, we think the text that we just deleted is needed, and then we use the undo operation to get back the old text. The same undoing in git is like doing undo in git. Common Scenarios for
6 min read
Git - Subtree
Managing large codebases with multiple dependencies or sub-projects can be a challenging task. Git, the popular version control system, provides several strategies for handling such cases. One effective solution is the use of Git Subtree. Git Subtree allows you to include a repository as a subdirect
4 min read
Git Worktree
Gitâs Worktree is a powerful tool that allows you to check out multiple branches simultaneously in the same repository. Itâs especially useful when you need to work on multiple features, bug fixes, or perform code reviews without having to switch branches or clone repositories constantly. In this ar
4 min read
Git Tutorial
Git is an essential tool for developers, enabling them to manage and track changes in their projects. Whether you're working on a solo project or collaborating with a team, Git keeps everything organized and under control. This Git Tutorial from beginner to advanced, will walk you through the basics
13 min read
Git Introduction
Git is a powerful and widely used version control system that helps developers track changes in their code, collaborate with others, and manage project history effectively. Whether you are a professional developer or just starting out, understanding Git is important for modern software development.
6 min read
Git - Merge
Git is a powerful version control system that helps developers manage code versions efficiently. One of the most fundamental operations in Git is merging, which allows you to integrate changes from one branch into another. What is Git Merge?Git merge is a command used to combine the changes from two
6 min read