What is the Git Working Tree? or working Area
About
The working tree (or working area) is a root directory and all its sub-directories where the work on your files happens (extraction, modification, commit).
Root
The location of the root work tree is:
- by default, the working directory when you have executed one of the following commands:
- clone: Pull from the server and checkout of the last files version (head)
- checked out (extracted) from the git repository
- or can be given via:
- the –work-tree option of the git command line tool
- or GIT_WORK_TREE environment variable
It's called a tree because the directory is synchronized by git in the git repository as a tree object.
Usage
It's an file system tree (area) where:
- you can browse and modify your files with your file explorer.
- 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)
Management
Purge
If you want to your working directory back to the status of upstream (server repo), the following commands can be used (remember everything you've worked on is gone after these):
git reset --hard upstream/master
git clean -fdx