Commit.create Async

Commit.create(repo, update_ref, author, committer, message_encoding, message, tree, parent_count, parents).then(function(oid) {
  // Use oid
});
Parameters Type
repo Repository Repository where to store the commit
update_ref String 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. If the reference doesn't exist yet, it will be created. If it does exist, the first parent must be the tip of this branch.
author Signature Signature with author and author time of commit
committer Signature Signature with committer and * commit time of commit
message_encoding String The encoding for the message in the commit, represented with a standard encoding name. E.g. "UTF-8". If NULL, no encoding header is written and UTF-8 is assumed.
message String Full message for this commit
tree Tree An instance of a git_tree object that will be used as the tree for the commit. This tree object must also be owned by the given repo.
parent_count Number Number of parents for this commit
parents Array Array of parent_count pointers to git_commit objects that will be used as the parents for this commit. This array may be NULL if parent_count is 0 (root commit). All the given commits must be owned by the repo.
Returns
Oid

Commit.createV Sync

var result = Commit.createV(id, repo, update_ref, author, committer, message_encoding, message, tree, parent_count);
Parameters Type
id Oid
repo Repository
update_ref String
author Signature
committer Signature
message_encoding String
message String
tree Tree
parent_count Number
Returns
Number

Commit.createWithSignature Async

Commit.createWithSignature(repo, commit_content, signature, signature_field).then(function(oid) {
  // Use oid
});
Parameters Type
repo Repository
commit_content String the content of the unsigned commit object
signature String the signature to add to the commit
signature_field String which header field should contain this signature. Leave NULL for the default of "gpgsig"
Returns
Oid the resulting commit id

Commit.lookup Async

Commit.lookup(repo, id).then(function(commit) {
  // Use commit
});

Retrieves the commit pointed to by the oid

Parameters Type
repo Repository The repo that the commit lives in
id String, Oid, Commit The commit to lookup
Returns
Commit

Commit.lookupPrefix Async

Commit.lookupPrefix(repo, id, len).then(function(commit) {
  // Use commit
});
Parameters Type
repo Repository the repo to use when locating the commit.
id Oid identity of the commit to locate. If the object is an annotated tag it will be peeled back to the commit.
len Number the length of the short identifier
Returns
Commit

Commit#amend Async

commit.amend(update_ref, author, committer, message_encoding, message, tree, callback).then(function() {
  // method complete});

Amend a commit

Parameters Type
update_ref String
author Signature
committer Signature
message_encoding String
message String
tree Tree, Oid
callback Oid

Commit#author Sync

var signature = commit.author();
Returns
Signature the author of a commit

Commit#body Sync

var string = commit.body();
Returns
String the body of a commit or NULL when no the message only
consists of a summary

Commit#committer Sync

var signature = commit.committer();
Returns
Signature the committer of a commit

Commit#date Sync

var date = commit.date();

Retrieve the commit time as a Date object.

Returns
Date

Commit#dup Async

commit.dup().then(function(commit) {
  // Use commit
});
Returns
Commit

Commit#free Sync

commit.free();

Commit#getDiff Async

commit.getDiff(callback).then(function(arrayDiff) {
  // Use arrayDiff
});

Generate an array of diff trees showing changes between this commit and its parent(s).

Parameters Type
callback Function
Returns
Array<Diff> an array of diffs

Commit#getDiffWithOptions Async

commit.getDiffWithOptions(options, callback).then(function(arrayDiff) {
  // Use arrayDiff
});

Generate an array of diff trees showing changes between this commit and its parent(s).

Parameters Type
options Object
callback Function
Returns
Array<Diff> an array of diffs

Commit#getEntry Async

commit.getEntry(path).then(function(treeEntry) {
  // Use treeEntry
});

Retrieve the entry represented by path for this commit. Path must be relative to repository root.

Parameters Type
path String
Returns
TreeEntry

Commit#getParents Async

commit.getParents(limit, callback).then(function(arrayCommit) {
  // Use arrayCommit
});

Retrieve the commit's parents as commit objects.

Parameters Type
limit number
callback Function
Returns
Array<Commit> array of commits

Commit#getTree Async

commit.getTree().then(function(tree) {
  // Use tree
});

Get the tree associated with this commit.

Returns
Tree

Commit#headerField Async

commit.headerField(field).then(function(buf) {
  // Use buf
});
Parameters Type
field String
Returns
Buf the buffer to fill

Commit#history Sync

var eventEmitter = commit.history();

eventEmitter.on('commit', function(commit) {
  // Use commit
});

eventEmitter.on('end', function(commits) {
  // Use commits
});

eventEmitter.on('error', function(error) {
  // Use error
});

eventEmitter.start()

Walk the history from this commit backwards.

An EventEmitter is returned that will emit a "commit" event for each commit in the history, and one "end" event when the walk is completed. Don't forget to call start() on the returned event.

Fires Sends
commit Commit
end Array<Commit>
error Error
Returns
EventEmitter

Commit#id Sync

var oid = commit.id();
Returns
Oid object identity for the commit.

Commit#message Sync

var string = commit.message();
Returns
String the message of a commit

Commit#messageEncoding Sync

var string = commit.messageEncoding();
Returns
String NULL, or the encoding

Commit#messageRaw Sync

var string = commit.messageRaw();
Returns
String the raw message of a commit

Commit#nthGenAncestor Async

commit.nthGenAncestor(n).then(function(commit) {
  // Use commit
});
Parameters Type
n Number
Returns
Commit the ancestor commit

Commit#owner Sync

var repository = commit.owner();
Returns
Repository Repository that contains this commit.

Commit#parent Async

commit.parent(n).then(function(commit) {
  // Use commit
});
Parameters Type
n Number
Returns
Commit the parent commit

Commit#parentId Sync

var oid = commit.parentId(n);
Parameters Type
n Number
Returns
Oid the id of the parent, NULL on error.

Commit#parentcount Sync

var result = commit.parentcount();
Returns
Number integer of count of parents

Commit#parents Sync

var arrayOid = commit.parents();

Retrieve the commit's parent shas.

Returns
Array<Oid> array of oids

Commit#rawHeader Sync

var string = commit.rawHeader();
Returns
String the header text of the commit

Commit#sha Sync

var string = commit.sha();

Retrieve the SHA.

Returns
String

Commit#summary Sync

var string = commit.summary();
Returns
String the summary of a commit or NULL on error

Commit#time Sync

var result = commit.time();
Returns
Number the time of a commit

Commit#timeMs Sync

var number = commit.timeMs();

Retrieve the commit time as a unix timestamp.

Returns
Number

Commit#timeOffset Sync

var result = commit.timeOffset();
Returns
Number positive or negative timezone offset, in minutes from UTC

Commit#toString Sync

var string = commit.toString();

The sha of this commit

Returns
String

Commit#tree Sync

var result = commit.tree(tree_out);
Parameters Type
tree_out Tree
Returns
Number 0 or an error code

Commit#treeId Sync

var oid = commit.treeId();
Returns
Oid the id of tree pointed to by commit.