Skip to content

Commit 37dd63b

Browse files
Correct documentation for GIT_WORK_TREE based on git-config(1)
The documentation for GIT_WORK_TREE incorrectly states that it will default to the parent directory of GIT_DIR. This contradicts the actual behavior and documentation of `core.worktree` in git-config(1): https://git-scm.com/docs/git-config#git-config-coreworktree
1 parent 00eaa5b commit 37dd63b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

book/10-git-internals/sections/environment.asc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ If this isn't specified, Git walks up the directory tree until it gets to `~` or
3838
*`GIT_CEILING_DIRECTORIES`* controls the behavior of searching for a `.git` directory.
3939
If you access directories that are slow to load (such as those on a tape drive, or across a slow network connection), you may want to have Git stop trying earlier than it might otherwise, especially if Git is invoked when building your shell prompt.
4040

41-
*`GIT_WORK_TREE`* is the location of the root of the working directory for a non-bare repository.
42-
If not specified, the parent directory of `$GIT_DIR` is used.
41+
*`GIT_WORK_TREE`* is the location of the root of the working directory for a non-bare repository. If --git-dir or GIT_DIR is specified but none of --work-tree, GIT_WORK_TREE and core.worktree is specified, the current working directory is regarded as the top level of your working tree.
4342

4443
*`GIT_INDEX_FILE`* is the path to the index file (non-bare repositories only).
4544

0 commit comments

Comments
 (0)