libgit2

git_commit_create

Version:

Create a new commit in the repository

Signature

int git_commit_create(git_oid *oid, git_repository *repo, const char *update_ref, const git_signature *author, const git_signature *committer, const char *message, const git_oid *tree_oid, int parent_count, const git_oid **parent_oids);

Parameters

In
oid

Pointer where to store the OID of the newly created commit

In
repo

Repository where to store the commit

const char *
In
update_ref

If not NULL, name of the reference that will be updated to point to this commit. If the reference is not direct, it will be resolved to a direct reference. Use "HEAD" to update the HEAD of the current branch and make it point to this commit

In
author

Signature representing the author and the authory time of this commit

In
committer

Signature representing the committer and the commit time of this commit

const char *
In
message

Full message for this commit

In
tree_oid

Object ID of the tree for this commit. Note that no validation is performed on this OID. Use the _o variants of this method to assure a proper tree is passed to the commit.

int
In
parent_count

Number of parents for this commit

In
parent_oids

Returns

int

0 on success; error code otherwise The created commit will be written to the Object Database and the given reference will be updated to point to it

Versions