libgit2

git_merge_trees

Version:

Merge two trees, producing a git_index that reflects the result of the merge. The index may be written as-is to the working directory or checked out. If the index is to be converted to a tree, the caller should resolve any conflicts that arose as part of the merge.

The returned index must be freed explicitly with git_index_free.

Signature

int git_merge_trees(git_index **out, git_repository *repo, const git_tree *ancestor_tree, const git_tree *our_tree, const git_tree *their_tree, const git_merge_options *opts);

Parameters

In
out

pointer to store the index result in

In
repo

repository that contains the given trees

In
ancestor_tree

the common ancestor between the trees (or null if none)

In
our_tree

the tree that reflects the destination tree

In
their_tree

the tree to merge in to our_tree

In
opts

the merge tree options (or null for defaults)

Returns

int

0 on success or error code

Versions