libgit2

git_merge_trees

Version:

Merge two trees, producing a git_index that reflects the result 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_tree_opts *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

zero on success, -1 on failure.

Versions