libgit2

git_merge_commits

Version:

Merge two commits, 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 merge performed uses the first common ancestor, unlike the git-merge-recursive strategy, which may produce an artificial common ancestor tree when there are multiple ancestors.

The returned index must be freed explicitly with git_index_free.

Signature

int git_merge_commits(git_index **out, git_repository *repo, const git_commit *our_commit, const git_commit *their_commit, const git_merge_options *opts);

Parameters

In
out

pointer to store the index result in

In
repo

repository that contains the given trees

In
our_commit

the commit that reflects the destination tree

In
their_commit

the commit to merge in to our_commit

In
opts

the merge tree options (or null for defaults)

Returns

int

0 on success or error code

Versions