### Method

# Ggit Repository create_commit

#### Declaration [src]

    GgitOId*
    ggit_repository_create_commit (
      GgitRepository* repository,
      const gchar* update_ref,
      GgitSignature* author,
      GgitSignature* committer,
      const gchar* message_encoding,
      const gchar* message,
      GgitTree* tree,
      GgitCommit** parents,
      gint parent_count,
      GError** error
    )

#### Description [src]

Create a new commit. If `update_ref` is not `NULL`, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.

If `message_encoding` is set to `NULL`, “UTF-8” encoding is assumed for the provided `message`. Note that `message` will not be cleaned up automatically. You can use #ggit_message_prettify to do this yourself if needed.

#### Parameters

`update_ref`

  Type: `const gchar*`

  Name of the reference to update.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`author`

  Type: `GgitSignature`

  Author signature.

  The data is owned by the caller of the method.

`committer`

  Type: `GgitSignature`

  Committer signature (and time of commit).

  The data is owned by the caller of the method.

`message_encoding`

  Type: `const gchar*`

  Message encoding.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`message`

  Type: `const gchar*`

  Commit message.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`tree`

  Type: `GgitTree`

  The tree of objects to commit.

  The data is owned by the caller of the method.

`parents`

  Type: An array of `GgitCommit*`

  Parent commits.

  The length of the array is specified in the `parent_count` argument.
  The data is owned by the caller of the method.

`parent_count`

  Type: `gint`

  Number of parent commits in `parents`.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GgitOId`

The `GgitOId` of the created commit object, or `NULL` in case of an error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be `NULL`.