GOT-WORKTREE(5) | File Formats Manual | GOT-WORKTREE(5) |
got-worktree
—
Game of Trees work tree format
A Got
work tree
stores a file hierarchy which corresponds to a versioned snapshot stored in
a Git repository. The work tree's meta data is stored in the
.got directory. A work tree is created with
got checkout
and is required to make changes to a
Git repository with got(1).
A work tree stores the path to its Git repository, the name of a reference to the branch which files were checked out from, and the ID of a commit on this branch known as the base commit.
File meta-data is stored in a structured file called the file index which tracks the status of file modifications, additions, and deletions, relative to the base commit in the repository. The file index contains a series of records, and each such record contains the following status information for a particular file:
got stage
.got
checkout
, got update
,
got cherrypick
, got
backout
, got rebase
, and
got histedit
are in progress. This flag is
always cleared before the entry is written to disk.got add
and when files are added to the work
tree by operations such as got cherrypick
,
got backout
, got
rebase
, and got histedit
.got add
and
when files are added to the work tree by operations such as
got cherrypick
, got
backout
, got rebase
, and
got histedit
.got
remove
.got
stage
.A corrupt or missing file index can be recreated on demand as follows:
$ mv .got/file-index
.got/file-index.bad
$ got update # re-create
.got/file-index
$ find . -type f -exec touch
{} + # update timestamp of all files
$ got update # sync
timestamps
When the file index is modified, it is read into memory in its entirety, modified in place, and written to a temporary file. This temporary file is then moved on top of the old file index with rename(2). This ensures that no other processes see an inconsistent file index which is in the process of being written.
Work tree meta data must only be modified while the work tree's lock file has been exclusively locked with lockf(3).
Each work tree has a universal unique identifier. When a work tree
is checked out or updated, this identifier is used to create a reference to
the current base commit in the Git repository. The presence of this
reference prevents the Git garbage collector and gotadmin
cleanup
from discarding the base commit and any objects it refers to.
When a work tree is no longer needed, its reference can be deleted from the
Git repository with got ref -d
.
got(1), rename(2), stat(2), umask(2), lockf(3), git-repository(5), got.conf(5)
January 31, 2025 | Debian |