Commit - SwiftDocOrg/Git GitHub Wiki

Commit

A commit object.

public final class Commit:​ Object

Inheritance

Object

Properties

owner

The repository containing the commit.

var owner:​ Repository

tree

The tree containing the commit, if any.

var tree:​ Tree?

parents

The parents of the commit.

var parents:​ [Commit]

message

The commit message, if any.

var message:​ String?

author

The signature of the author.

var author:​ Signature

committer

The signature of the committer.

var committer:​ Signature

Methods

distance(to:​)

Calculates the number of unique revisions to another commit.

public func distance(to upstream:​ Commit) throws -> (ahead:​ Int, behind:​ Int)

Parameters

  • upstream:​ The upstream commit.

Returns

A tuple with the number of commits ahead and behind.

isDescendent(of:​)

Determines whether the commit is a descendent of another commit.

public func isDescendent(of ancestor:​ Commit) throws -> Bool

Parameters

  • ancestor:​ The presumptive ancestor.