About
The working tree (or working area) is a directory where the work happens (extraction, modification, commit).
It's on the local file system:
- a directory where the files of the git repository have been extracted (checkout). You can then browse and modify them with your file explorer.
- an area where you will see all modified file that are not yet committed. Before running the commit command, you must use the add command to add any new or modified files to the index (staging area)
- It's called a tree because the directory is synchronized by git in the git repository as a tree object.
- The working tree is by default a checkout of the last files version (head).
Management
Location
The location of the work tree is:
- by default, the working directory
- or can be given via:
- the –work-tree option of the git command line tool
- or GIT_WORK_TREE environment variable
Purge
If you want to your working directory back to the status of upstream, the following commands can be used (remember everything you've worked on is gone after these):
git reset --hard upstream/master
git clean -fdx