'\" t
.\"     Title: git-write-tree
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 02/02/2026
.\"    Manual: Git Manual
.\"    Source: Git 2.53.0
.\"  Language: English
.\"
.TH "GIT\-WRITE\-TREE" "1" "02/02/2026" "Git 2\&.53\&.0" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-write-tree \- Create a tree object from the current index
.SH "SYNOPSIS"
.sp
.nf
\fBgit\fR \fBwrite\-tree\fR [\fB\-\-missing\-ok\fR] [\fB\-\-prefix=\fR\fI<prefix>\fR\fB/\fR]
.fi
.SH "DESCRIPTION"
.sp
Creates a tree object using the current index\&. The name of the new tree object is printed to standard output\&.
.sp
The index must be in a fully merged state\&.
.sp
Conceptually, \fBgit\fR \fBwrite\-tree\fR sync()s the current index contents into a set of tree files\&. In order to have that match what is actually in your directory right now, you need to have done a \fBgit\fR \fBupdate\-index\fR phase before you did the \fBgit\fR \fBwrite\-tree\fR\&.
.SH "OPTIONS"
.PP
\fB\-\-missing\-ok\fR
.RS 4
Normally
\fBgit\fR
\fBwrite\-tree\fR
ensures that the objects referenced by the directory exist in the object database\&. This option disables this check\&.
.RE
.PP
\fB\-\-prefix=\fR\fI<prefix>\fR\fB/\fR
.RS 4
Writes a tree object that represents a subdirectory
\fI<prefix>\fR\&. This can be used to write the tree object for a subproject that is in the named subdirectory\&.
.RE
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite
