libgit2

git_merge

Version:

Merges the given commit(s) into HEAD, writing the results into the working directory. Any changes are staged for commit and any conflicts are written to the index. Callers should inspect the repository's index after this completes, resolve any conflicts and prepare a commit.

For compatibility with git, the repository is put into a merging state. Once the commit is done (or if the uses wishes to abort), you should clear this state by calling git_repository_state_cleanup().

Signature

int git_merge(git_repository *repo, const git_annotated_commit **their_heads, size_t their_heads_len, const git_merge_options *merge_opts, const git_checkout_options *checkout_opts);

Parameters

In
repo

the repository to merge

In
their_heads

the heads to merge into

size_t
In
their_heads_len

the number of heads to merge

In
merge_opts

merge options

In
checkout_opts

checkout options

Returns

int

0 on success or error code

Versions