Working tree vs working directory

Current directory

is your current folder, command line ls list the items in your current directory

Working tree

is your current directory plus all the directory paths in it, if it were me, I'd rename it to 'working directory tree' so the term 'tree' lends itself more to a directory structure in your minds eye and less to a git tree structure

Working directory

is ambiguously used to refer to both of these cases, don't use this word. It confuses everyone.


There is a subtle difference in meaning.

A directory is a singular thing -- a folder, a collection of files -- whereas a working tree means a tree like structure of files and directories that are collectively referenced.

Working tree means the directory that contains the .git folder, including all sub directories and files.

To understand this more completely, you have to understand who created Git: Linus Torvalds. Everything in Git is closely related to Linux naming conventions and thought processes, which includes how Git "thinks" about files or the file system:

From 3.1.3. More file system layout

For convenience, the Linux file system is usually thought of in a tree structure. On a standard Linux system you will find the layout generally follows the scheme presented below.

Linux file system diagram

So it's called a "working tree" because Linux kernal/file system developers built Git, and in Linux the file system is thought of as a "tree".


This was done to improve consistency and avoid ambiguity. As explained in the commit that changed this behavior:

Working directory can be easily confused with the current directory.

So this change was made to better disambiguate between the working tree, meaning the location where your repository has been checked out, and the working directory where you are running the git status command, which may be somewhere beneath your working tree (or perhaps not, if you set GIT_WORK_TREE environment variable).

Tags:

Git