The tree of actual checked out files.
The working tree normally contains the contents of the HEAD commit's tree, plus any local changes that were made but not yet committed.
Clean working tree
A working tree is clean, if it corresponds to the revision refrenced by the current head.
Conversely, the tree is dirty if it contains modifications not committed to the current branch.
Determine interesting directories
git rev-parse
has some command line options which allow to determine interesting directories when executed from within a working directory.
git init --quiet repo
cd repo
Create directory, a subdirectory ind descend into it:
$null = mkdir dir
$null = mkdir dir/subdir
cd dir/subdir
Show the absolute path to the top level directory:
git rev-parse --show-toplevel
Show the relative path to the top level directory with a trailing slash (in this case: ../../
):
git rev-parse --show-cdup
Show the relative path from the top level directory to the current directory with a trailing slash (in this case dir/subdir/
):
git rev-parse --show-prefix
Show the absolute location of the
git dir:
git rev-parse --git-dir