libgit2

git_index_write_tree

Version:

Write the index as a tree

This method will scan the index and write a representation of its current state back to disk; it recursively creates tree objects for each of the subtrees stored in the index, but only returns the OID of the root tree. This is the OID that can be used e.g. to create a commit.

The index instance cannot be bare, and needs to be associated to an existing repository.

The index must not contain any file in conflict.

Signature

int git_index_write_tree(git_oid *out, git_index *index);

Parameters

In
out

Pointer where to store the OID of the written tree

In
index

Index to write

Returns

int

0 on success, GIT_EUNMERGED when the index is not clean or an error code

Versions