添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
The working tree normally contains the contents of the HEAD commit's tree, plus any local changes that were made but not yet committed. A working tree is associated with exactly one branch .

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. Initialize a new repository for the demonstration:
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

See also

The --work-tree command line option . .git/worktrees working directory