Repository.discover Async

Repository.discover(startPath, acrossFs, ceilingDirs).then(function(string) {
  // Use string
});

Creates a branch with the passed in name pointing to the commit

Parameters Type
startPath String The base path where the lookup starts.
acrossFs Number If non-zero, then the lookup will not stop when a filesystem device change is detected while exploring parent directories.
ceilingDirs String A list of absolute symbolic link free paths. the search will stop if any of these paths are hit. This may be set to null
Returns
String Path of the git repository

Repository.init Async

Repository.init(path, is_bare).then(function(repository) {
  // Use repository
});
Parameters Type
path String the path to the repository
is_bare Number if true, a Git repository without a working directory is created at the pointed path. If false, provided path will be considered as the working directory into which the .git directory will be created.
Returns
Repository

Repository.initExt Async

Repository.initExt(repo_path, opts).then(function(repository) {
  // Use repository
});
Parameters Type
repo_path String The path to the repository.
opts RepositoryInitOptions Pointer to git_repository_init_options struct.
Returns
Repository

Repository.open Async

Repository.open(path).then(function(repository) {
  // Use repository
});
Parameters Type
path String the path to the repository
Returns
Repository

Repository.openBare Async

Repository.openBare(bare_path).then(function(repository) {
  // Use repository
});
Parameters Type
bare_path String Direct path to the bare repository
Returns
Repository

Repository.openExt Async

Repository.openExt(path, flags, ceiling_dirs).then(function(repository) {
  // Use repository
});
Parameters Type
path String Path to open as git repository. If the flags permit "searching", then this can be a path to a subdirectory inside the working directory of the repository. May be NULL if flags is GIT_REPOSITORY_OPEN_FROM_ENV.
flags Number A combination of the GIT_REPOSITORY_OPEN flags above.
ceiling_dirs String A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at which the search for a containing repository should terminate.
Returns
Repository

Repository.wrapOdb Async

Repository.wrapOdb(odb).then(function(repository) {
  // Use repository
});
Parameters Type
odb Odb the object database to wrap
Returns
Repository

Repository#checkoutBranch Async

repository.checkoutBranch(branch, opts).then(function() {
  // method complete});

This will set the HEAD to point to the local branch and then attempt to update the index and working tree to match the content of the latest commit on that branch

Parameters Type
branch String, Reference
opts Object, CheckoutOptions

Repository#checkoutRef Async

repository.checkoutRef(reference, opts).then(function() {
  // method complete});

This will set the HEAD to point to the reference and then attempt to update the index and working tree to match the content of the latest commit on that reference

Parameters Type
reference Reference
opts Object, CheckoutOptions

Repository#cleanup Sync

repository.cleanup();

Repository#config Async

repository.config().then(function(config) {
  // Use config
});
Returns
Config

Repository#configSnapshot Async

repository.configSnapshot().then(function(config) {
  // Use config
});
Returns
Config

Repository#continueRebase Async

repository.continueRebase(signature, beforeNextFn, beforeFinishFn).then(function(oid) {
  // Use oid
});

Continues an existing rebase

Parameters Type
signature Signature
beforeNextFn Function
beforeFinishFn Function
Returns
Oid A commit id for a succesful merge or an index for a rebase with conflicts

Repository#createBlobFromBuffer Sync

var oid = repository.createBlobFromBuffer(buffer);

Create a blob from a buffer

Parameters Type
buffer Buffer
Returns
Oid

Repository#createBranch Async

repository.createBranch(name, commit, force).then(function(reference) {
  // Use reference
});

Creates a branch with the passed in name pointing to the commit

Parameters Type
name String
commit Commit, String, Oid
force bool
Returns
Reference

Repository#createCommit Async

repository.createCommit(updateRef, author, committer, message, Tree, parents).then(function(oid) {
  // Use oid
});

Create a commit

Parameters Type
updateRef String
author Signature
committer Signature
message String
Tree Tree, Oid, String
parents Array
Returns
Oid The oid of the commit

Repository#createCommitOnHead Async

repository.createCommitOnHead(filesToAdd, author, committer, message).then(function(oid) {
  // Use oid
});

Creates a new commit on HEAD from the list of passed in files

Parameters Type
filesToAdd Array
author Signature
committer Signature
message String
Returns
Oid The oid of the new commit

Repository#createLightweightTag Async

repository.createLightweightTag(String, name).then(function(reference) {
  // Use reference
});

Creates a new lightweight tag

Parameters Type
String String, Oid
name String
Returns
Reference

Repository#createRevWalk Sync

var revWalk = repository.createRevWalk(String);

Instantiate a new revision walker for browsing the Repository"s history. See also Commit.prototype.history()

Parameters Type
String String, Oid
Returns
RevWalk

Repository#createTag Async

repository.createTag(String, name, message).then(function(tag) {
  // Use tag
});

Creates a new annotated tag

Parameters Type
String String, Oid
name String
message String
Returns
Tag

Repository#defaultSignature Sync

var signature = repository.defaultSignature();

Gets the default signature for the default user and now timestamp

Returns
Signature

Repository#deleteTagByName Async

repository.deleteTagByName(Short).then(function() {
  // method complete});

Deletes a tag from a repository by the tag name.

Parameters Type
Short String

Repository#detachHead Sync

var result = repository.detachHead();
Returns
Number 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
branch or an error code

Repository#discardLines Async

repository.discardLines(filePath, selectedLines).then(function(number) {
  // Use number
});

Discard line selection of a specified file. Assumes selected lines are unstaged.

Parameters Type
filePath String
selectedLines Array
Returns
Number 0 or an error code

Repository#fetch Async

repository.fetch(remote, fetchOptions).then(function() {
  // method complete});

Fetches from a remote

Parameters Type
remote String, Remote
fetchOptions Object, FetchOptions

Repository#fetchAll Async

repository.fetchAll(fetchOptions, callback).then(function() {
  // method complete});

Fetches from all remotes. This is done in series due to deadlocking issues with fetching from many remotes that can happen.

Parameters Type
fetchOptions Object, FetchOptions
callback Function

Repository#fetchheadForeach Async

repository.fetchheadForeach(callback).then(function() {
  // method complete});
Parameters Type
callback FetchheadForeachCb

Repository#free Sync

repository.free();

Repository#getBlob Async

repository.getBlob(String).then(function(blob) {
  // Use blob
});

Retrieve the blob represented by the oid.

Parameters Type
String String, Oid
Returns
Blob

Repository#getBranch Async

repository.getBranch(name).then(function(reference) {
  // Use reference
});

Look up a branch. Alias for getReference

Parameters Type
name String, Reference
Returns
Reference

Repository#getBranchCommit Async

repository.getBranchCommit(name).then(function(commit) {
  // Use commit
});

Look up a branch's most recent commit. Alias to getReferenceCommit

Parameters Type
name String, Reference
Returns
Commit

Repository#getCommit Async

repository.getCommit(String).then(function(commit) {
  // Use commit
});

Retrieve the commit identified by oid.

Parameters Type
String String, Oid
Returns
Commit

Repository#getCurrentBranch Async

repository.getCurrentBranch().then(function(reference) {
  // Use reference
});

Gets the branch that HEAD currently points to Is an alias to head()

Returns
Reference

Repository#getHeadCommit Async

repository.getHeadCommit().then(function(commit) {
  // Use commit
});

Retrieve the commit that HEAD is currently pointing to

Returns
Commit

Repository#getMasterCommit Async

repository.getMasterCommit().then(function(commit) {
  // Use commit
});

Retrieve the master branch commit.

Returns
Commit

Repository#getNamespace Sync

var string = repository.getNamespace();
Returns
String the active namespace, or NULL if there isn't one

Repository#getReference Async

repository.getReference(name).then(function(reference) {
  // Use reference
});

Lookup the reference with the given name.

Parameters Type
name String, Reference
Returns
Reference

Repository#getReferenceCommit Async

repository.getReferenceCommit(name).then(function(commit) {
  // Use commit
});

Look up a refs's commit.

Parameters Type
name String, Reference
Returns
Commit

Repository#getReferenceNames Async

repository.getReferenceNames(type).then(function(arrayString) {
  // Use arrayString
});

Lookup reference names for a repository.

Parameters Type
type Reference.TYPE
Returns
Array<String>

Repository#getReferences Async

repository.getReferences(type).then(function(arrayReference) {
  // Use arrayReference
});

Lookup references for a repository.

Parameters Type
type Reference.TYPE
Returns
Array<Reference>

Repository#getRemote Async

repository.getRemote(remote, callback).then(function(remote) {
  // Use remote
});

Gets a remote from the repo

Parameters Type
remote String, Remote
callback Function
Returns
Remote The remote object

Repository#getRemotes Async

repository.getRemotes(Optional).then(function(object) {
  // Use object
});

Lists out the remotes in the given repository.

Parameters Type
Optional Function
Returns
Object Promise object.

Repository#getStatus Async

repository.getStatus(opts).then(function(arrayStatusFile) {
  // Use arrayStatusFile
});

Get the status of a repo to it's working directory

Parameters Type
opts obj
Returns
Array<StatusFile>

Repository#getStatusExt Async

repository.getStatusExt(opts).then(function(arrayStatusFile) {
  // Use arrayStatusFile
});

Get extended statuses of a repo to it's working directory. Status entries have status, headToIndex delta, and indexToWorkdir deltas

Parameters Type
opts obj
Returns
Array<StatusFile>

Repository#getSubmoduleNames Async

repository.getSubmoduleNames().then(function(arrayString) {
  // Use arrayString
});

Get the names of the submodules in the repository.

Returns
Array<String>

Repository#getTag Async

repository.getTag(String).then(function(tag) {
  // Use tag
});

Retrieve the tag represented by the oid.

Parameters Type
String String, Oid
Returns
Tag

Repository#getTagByName Async

repository.getTagByName(Short).then(function(tag) {
  // Use tag
});

Retrieve the tag represented by the tag name.

Parameters Type
Short String
Returns
Tag

Repository#getTree Async

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

Retrieve the tree represented by the oid.

Parameters Type
String String, Oid
Returns
Tree

Repository#head Async

repository.head().then(function(reference) {
  // Use reference
});
Returns
Reference

Repository#headDetached Sync

var result = repository.headDetached();
Returns
Number 1 if HEAD is detached, 0 if it's not; error code if there
was an error.

Repository#headUnborn Sync

var result = repository.headUnborn();
Returns
Number 1 if the current branch is unborn, 0 if it's not; error
code if there was an error

Repository#index Async

repository.index().then(function(index) {
  // Use index
});
Returns
Index

Repository#isApplyingMailbox Sync

var boolean = repository.isApplyingMailbox();

Returns true if the repository is in the APPLY_MAILBOX or APPLY_MAILBOX_OR_REBASE state.

Returns
Boolean

Repository#isBare Sync

var result = repository.isBare();
Returns
Number 1 if the repository is bare, 0 otherwise.

Repository#isBisecting Sync

var boolean = repository.isBisecting();

Returns true if the repository is in the BISECT state.

Returns
Boolean

Repository#isCherrypicking Sync

var boolean = repository.isCherrypicking();

Returns true if the repository is in the CHERRYPICK state.

Returns
Boolean

Repository#isDefaultState Sync

var boolean = repository.isDefaultState();

Returns true if the repository is in the default NONE state.

Returns
Boolean

Repository#isEmpty Sync

var result = repository.isEmpty();
Returns
Number 1 if the repository is empty, 0 if it isn't, error code
if the repository is corrupted

Repository#isMerging Sync

var boolean = repository.isMerging();

Returns true if the repository is in the MERGE state.

Returns
Boolean

Repository#isRebasing Sync

var boolean = repository.isRebasing();

Returns true if the repository is in the REBASE, REBASE_INTERACTIVE, or REBASE_MERGE state.

Returns
Boolean

Repository#isReverting Sync

var boolean = repository.isReverting();

Returns true if the repository is in the REVERT state.

Returns
Boolean

Repository#isShallow Sync

var result = repository.isShallow();
Returns
Number 1 if shallow, zero if not

Repository#mergeBranches Async

repository.mergeBranches(to, from, signature, mergePreference, mergeOptions).then(function(oid) {
  // Use oid
});

Merge a branch onto another branch

Parameters Type
to String, Reference
from String, Reference
signature Signature
mergePreference Merge.PREFERENCE
mergeOptions MergeOptions
Returns
Oid A commit id for a succesful merge or an index for a merge with conflicts

Repository#mergeheadForeach Async

repository.mergeheadForeach(callback).then(function() {
  // method complete});
Parameters Type
callback MergeheadForeachCb

Repository#messageRemove Sync

var result = repository.messageRemove();
Returns
Number

Repository#odb Async

repository.odb().then(function(odb) {
  // Use odb
});
Returns
Odb

Repository#path Sync

var string = repository.path();
Returns
String the path to the repository

Repository#rebaseBranches Async

repository.rebaseBranches(branch, upstream, onto, signature, beforeNextFn, beforeFinishFn).then(function(oid) {
  // Use oid
});

Rebases a branch onto another branch

Parameters Type
branch String
upstream String
onto String
signature Signature
beforeNextFn Function
beforeFinishFn Function
Returns
Oid A commit id for a succesful merge or an index for a rebase with conflicts

Repository#refdb Async

repository.refdb().then(function(refdb) {
  // Use refdb
});
Returns
Refdb

Repository#refreshIndex Async

repository.refreshIndex().then(function(index) {
  // Use index
});

Grabs a fresh copy of the index from the repository. Invalidates all previously grabbed indexes

Returns
Index

Repository#setHead Async

repository.setHead(refname).then(function(result) {
  // Use result
});
Parameters Type
refname String
Returns
Number 0 on success, or an error code

Repository#setHeadDetached Sync

var result = repository.setHeadDetached(commitish);
Parameters Type
commitish Oid
Returns
Number 0 on success, or an error code

Repository#setHeadDetachedFromAnnotated Sync

var result = repository.setHeadDetachedFromAnnotated(commitish);
Parameters Type
commitish AnnotatedCommit
Returns
Number

Repository#setIdent Sync

var result = repository.setIdent(name, email);
Parameters Type
name String
email String
Returns
Number

Repository#setIndex Sync

repository.setIndex(index);
Parameters Type
index Index

Repository#setNamespace Sync

var result = repository.setNamespace(nmspace);
Parameters Type
nmspace String
Returns
Number 0 on success, -1 on error

Repository#setWorkdir Sync

var result = repository.setWorkdir(workdir, update_gitlink);
Parameters Type
workdir String
update_gitlink Number
Returns
Number 0, or an error code

Repository#stageFilemode Async

repository.stageFilemode(filePath, stageNew).then(function(number) {
  // Use number
});

Stages or unstages line selection of a specified file

Parameters Type
filePath String, Array
stageNew Boolean
Returns
Number 0 or an error code

Repository#stageLines Async

repository.stageLines(filePath, selectedLines, isStaged).then(function(number) {
  // Use number
});

Stages or unstages line selection of a specified file

Parameters Type
filePath String
selectedLines Array
isStaged Boolean
Returns
Number 0 or an error code

Repository#state Sync

var result = repository.state();
Returns
Number The state of the repository

Repository#stateCleanup Sync

var result = repository.stateCleanup();
Returns
Number 0 on success, or error

Repository#submoduleCacheAll Sync

var result = repository.submoduleCacheAll();
Returns
Number

Repository#submoduleCacheClear Sync

var result = repository.submoduleCacheClear();
Returns
Number

Repository#treeBuilder Sync

repository.treeBuilder(tree);

Create a new tree builder.

Parameters Type
tree Tree

Repository#workdir Sync

var string = repository.workdir();
Returns
String the path to the working dir, if it exists

Repository.INIT_FLAG ENUM

Flag Value
Repository.INIT_FLAG.BARE 1
Repository.INIT_FLAG.NO_REINIT 2
Repository.INIT_FLAG.NO_DOTGIT_DIR 4
Repository.INIT_FLAG.MKDIR 8
Repository.INIT_FLAG.MKPATH 16
Repository.INIT_FLAG.EXTERNAL_TEMPLATE 32
Repository.INIT_FLAG.RELATIVE_GITLINK 64

Repository.INIT_MODE ENUM

Flag Value
Repository.INIT_MODE.INIT_SHARED_UMASK 0
Repository.INIT_MODE.INIT_SHARED_GROUP 1533
Repository.INIT_MODE.INIT_SHARED_ALL 1535

Repository.OPEN_FLAG ENUM

Flag Value
Repository.OPEN_FLAG.OPEN_NO_SEARCH 1
Repository.OPEN_FLAG.OPEN_CROSS_FS 2
Repository.OPEN_FLAG.OPEN_BARE 4
Repository.OPEN_FLAG.OPEN_NO_DOTGIT 8
Repository.OPEN_FLAG.OPEN_FROM_ENV 16

Repository.STATE ENUM

Flag Value
Repository.STATE.NONE 0
Repository.STATE.MERGE 1
Repository.STATE.REVERT 2
Repository.STATE.REVERT_SEQUENCE 3
Repository.STATE.CHERRYPICK 4
Repository.STATE.CHERRYPICK_SEQUENCE 5
Repository.STATE.BISECT 6
Repository.STATE.REBASE 7
Repository.STATE.REBASE_INTERACTIVE 8
Repository.STATE.REBASE_MERGE 9
Repository.STATE.APPLY_MAILBOX 10
Repository.STATE.APPLY_MAILBOX_OR_REBASE 11