Git.framework Reference Library

GITCommit Class Reference

GITCommit Class Reference

Inherits from
Conforms to
Declared in GITCommit.h

Overview

This class represents Commit objects in a git repository.

Commit objects are markers of the state of a repository at a specific moment in time, they reference trees which define the file system structure of a repository at a given point.

Commit objects look like the following, the parent may be repeated.

 tree 80655da8d80aaaf92ce5357e7828dc09adb00993
 parent d8fd39d0bbdd2dcf322d8b11390a4c5825b11495
 author A. Developer <dev@example.com> 444123000 +0000
 committer A. Developer <dev@example.com> 444123000 +0000
 
 A commit message meant to describe what this commit is all about

Tasks

Properties

parentShas

Array of GITObjectHash objects of the parents.

@property NSArray *parentShas
Declared In
GITCommit.h

parents

Array of GITCommit parents.

@property NSArray *parents
Declared In
GITCommit.h

tree

The tree object the commit references.

@property GITTree *tree
Declared In
GITCommit.h

author

Author of the commit.

@property GITActor *author
Declared In
GITCommit.h

committer

Committer of the commit, different from author if the commit was created by patching.

@property GITActor *committer
Declared In
GITCommit.h

authorDate

Date the commit was created.

@property GITDateTime *authorDate
Declared In
GITCommit.h

committerDate

Date the commit was committed to the repository via patching.

@property GITDateTime *committerDate
Declared In
GITCommit.h

message

Commit message.

@property NSString *message
Declared In
GITCommit.h

Class Methods

commitFromData:sha1:repo:error:

+ (GITCommit *)commitFromData:(NSData *)data sha1:(GITObjectHash *)objectHash repo:(GITRepo *)repo error:(NSError **)error
Parameters
data

The data describing the commit

objectHash

The SHA1 hash of the receiver

repo

The repository the commit is a member of

error

NSError describing the error that occurred

Return Value

A commit object from the data

Discussion

Creates and returns a commit from the data.

The data content is parsed to extract the information about the commit such as the referenced tree, parents, author, committer, dates and the commit message.

Declared In
GITCommit.h

Instance Methods

parentSha1

- (NSString *)parentSha1
Return Value

SHA1 of the parent commit

Discussion

Returns the last SHA1 in the list of parent commits.

See Also
Declared In
GITCommit.h

isMerge

- (BOOL)isMerge
Return Value

YES if the receiver is a merge point, NO if only one parent

Discussion

Returns YES if the receiver is a merge point, NO if it has only one parent.

See Also
Declared In
GITCommit.h

isInitial

- (BOOL)isInitial
Return Value

YES if the receiver is the first commit, NO otherwise.

Discussion

Returns YES if the receiver if the first commit, NO otherwise.

See Also
Declared In
GITCommit.h

Last updated: 2011-2-20