layout
menu_item
title
description
return_to
sections
default
api
Reference
Version 0.26.1
API Documentation Index
/api/
create
createMatching
dwim
ensureLog
hasLog
isValidName
list
lookup
nameToId
normalizeName
remove
symbolicCreate
symbolicCreateMatching
updateTerminal
#cmp
#delete
#dup
#isBranch
#isConcrete
#isHead
#isNote
#isRemote
#isSymbolic
#isTag
#isValid
#name
#owner
#peel
#rename
#resolve
#setTarget
#shorthand
#symbolicSetTarget
#symbolicTarget
#target
#targetPeel
#toString
#type
FORMAT
TYPE
#create
#createMatching
#dwim
#ensureLog
#hasLog
#isValidName
#list
#lookup
#nameToId
#normalizeName
#remove
#symbolicCreate
#symbolicCreateMatching
#updateTerminal
#cmp
#delete
#dup
#isBranch
#isConcrete
#isHead
#isNote
#isRemote
#isSymbolic
#isTag
#isValid
#name
#owner
#peel
#rename
#resolve
#setTarget
#shorthand
#symbolicSetTarget
#symbolicTarget
#target
#targetPeel
#toString
#type
#FORMAT
#TYPE
Reference. create Async Experimental
Reference . create ( repo , name , id , force , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
Parameters
Type
repo
Repository
Repository where that reference will live
name
String
The name of the reference
id
Oid
The object id pointed to by the reference.
force
Number
Overwrite existing references
log_message
String
The one line long message to be appended to the reflog
Reference. createMatching Async Experimental
Reference . createMatching ( repo , name , id , force , current_id , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
Parameters
Type
repo
Repository
Repository where that reference will live
name
String
The name of the reference
id
Oid
The object id pointed to by the reference.
force
Number
Overwrite existing references
current_id
Oid
The expected value of the reference at the time of update
log_message
String
The one line long message to be appended to the reflog
Reference . dwim ( repo , id , callback ) . then ( function ( reference ) {
// Use reference
} ) ;
Retrieves the reference by it's short name
Parameters
Type
repo
Repository
The repo that the reference lives in
id
String, Reference
The reference to lookup
callback
Function
Reference. ensureLog Sync Experimental
var result = Reference . ensureLog ( repo , refname ) ;
Parameters
Type
repo
Repository
the repository
refname
String
the reference's name
Returns
Number
0 or an error code.
Reference. hasLog Sync Experimental
var result = Reference . hasLog ( repo , refname ) ;
Parameters
Type
repo
Repository
the repository
refname
String
the reference's name
Returns
Number
0 when no reflog can be found, 1 when it exists;
otherwise an error code.
Reference. isValidName Sync Experimental
var result = Reference . isValidName ( refname ) ;
Parameters
Type
refname
String
name to be checked.
Returns
Number
1 if the reference name is acceptable; 0 if it isn't
Reference. list Async Experimental
Reference . list ( repo ) . then ( function ( array ) {
// Use array
} ) ;
Parameters
Type
repo
Repository
Repository where to find the refs
Reference . lookup ( repo , id , callback ) . then ( function ( reference ) {
// Use reference
} ) ;
Retrieves the reference pointed to by the oid
Parameters
Type
repo
Repository
The repo that the reference lives in
id
String, Reference
The reference to lookup
callback
Function
Reference. nameToId Async Experimental
Reference . nameToId ( repo , name ) . then ( function ( oid ) {
// Use oid
} ) ;
Parameters
Type
repo
Repository
The repository in which to look up the reference
name
String
The long name for the reference (e.g. HEAD, refs/heads/master, refs/tags/v0.1.0, ...)
Reference. normalizeName Sync Experimental
var result = Reference . normalizeName ( buffer_out , buffer_size , name , flags ) ;
Parameters
Type
buffer_out
String
User allocated buffer to store normalized name
buffer_size
Number
Size of buffer_out
name
String
Reference name to be checked.
flags
Number
Flags to constrain name validation rules - see the GIT_REFERENCE_FORMAT constants above.
Returns
Number
0 on success, GIT_EBUFS if buffer is too small, GIT_EINVALIDSPEC
or an error code.
Reference. remove Sync Experimental
var result = Reference . remove ( repo , name ) ;
Parameters
Type
repo
Repository
name
String
The reference to remove
Returns
Number
0 or an error code
Reference. symbolicCreate Async Experimental
Reference . symbolicCreate ( repo , name , target , force , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
Parameters
Type
repo
Repository
Repository where that reference will live
name
String
The name of the reference
target
String
The target of the reference
force
Number
Overwrite existing references
log_message
String
The one line long message to be appended to the reflog
Reference. symbolicCreateMatching Async Experimental
Reference . symbolicCreateMatching ( repo , name , target , force , current_value , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
Parameters
Type
repo
Repository
Repository where that reference will live
name
String
The name of the reference
target
String
The target of the reference
force
Number
Overwrite existing references
current_value
String
The expected value of the reference when updating
log_message
String
The one line long message to be appended to the reflog
Reference. updateTerminal Async
Reference . updateTerminal ( repo , refName , oid , logMessage , signature ) . then ( function ( ) {
// method complete });
Given a reference name, follows symbolic links and updates the direct
reference to point to a given OID. Updates the reflog with a given message.
Parameters
Type
repo
Repository
The repo where the reference and objects live
refName
String
The reference name to update
oid
Oid
The target OID that the reference will point to
logMessage
String
The reflog message to be writted
signature
Signature
Optional signature to use for the reflog entry
Reference# cmp Sync Experimental
var result = reference . cmp ( ref2 ) ;
| Parameters | Type |
| --- | --- | --- |
| ref2 | Reference | The second git_reference |
Returns
Number
0 if the same, else a stable but meaningless ordering.
Reference# delete Sync Experimental
var result = reference . delete ( ) ;
Returns
Number
0, GIT_EMODIFIED or an error code
Reference# dup Async Experimental
reference . dup ( ) . then ( function ( reference ) {
// Use reference
} ) ;
Reference# isBranch Sync Experimental
var result = reference . isBranch ( ) ;
Returns
Number
1 when the reference lives in the refs/heads
namespace; 0 otherwise.
Reference# isConcrete Sync
var boolean = reference . isConcrete ( ) ;
Returns true if this reference is not symbolic
var boolean = reference . isHead ( ) ;
Returns if the ref is pointed at by HEAD
Reference# isNote Sync Experimental
var result = reference . isNote ( ) ;
Returns
Number
1 when the reference lives in the refs/notes
namespace; 0 otherwise.
Reference# isRemote Sync Experimental
var result = reference . isRemote ( ) ;
Returns
Number
1 when the reference lives in the refs/remotes
namespace; 0 otherwise.
Reference# isSymbolic Sync
var boolean = reference . isSymbolic ( ) ;
Returns true if this reference is symbolic
Reference# isTag Sync Experimental
var result = reference . isTag ( ) ;
Returns
Number
1 when the reference lives in the refs/tags
namespace; 0 otherwise.
var boolean = reference . isValid ( ) ;
Returns true if this reference is valid
Reference# name Sync Experimental
var string = reference . name ( ) ;
Returns
String
the full name for the ref
Reference# owner Sync Experimental
var repository = reference . owner ( ) ;
Reference# peel Async Experimental
reference . peel ( type ) . then ( function ( object ) {
// Use object
} ) ;
| Parameters | Type |
| --- | --- | --- |
| type | Number | The type of the requested object (GIT_OBJECT_COMMIT, GIT_OBJECT_TAG, GIT_OBJECT_TREE, GIT_OBJECT_BLOB or GIT_OBJECT_ANY). |
Reference# rename Async Experimental
reference . rename ( new_name , force , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
| Parameters | Type |
| --- | --- | --- |
| new_name | String | The new name for the reference |
| force | Number | Overwrite an existing reference |
| log_message | String | The one line long message to be appended to the reflog |
Reference# resolve Async Experimental
reference . resolve ( ) . then ( function ( reference ) {
// Use reference
} ) ;
Reference# setTarget Async Experimental
reference . setTarget ( id , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
| Parameters | Type |
| --- | --- | --- |
| id | Oid | The new target OID for the reference |
| log_message | String | The one line long message to be appended to the reflog |
Reference# shorthand Sync Experimental
var string = reference . shorthand ( ) ;
Returns
String
the human-readable version of the name
Reference# symbolicSetTarget Async Experimental
reference . symbolicSetTarget ( target , log_message ) . then ( function ( reference ) {
// Use reference
} ) ;
| Parameters | Type |
| --- | --- | --- |
| target | String | The new target for the reference |
| log_message | String | The one line long message to be appended to the reflog |
Reference# symbolicTarget Sync Experimental
var string = reference . symbolicTarget ( ) ;
Returns
String
the name if available, NULL otherwise
Reference# target Sync Experimental
var oid = reference . target ( ) ;
Returns
Oid
the oid if available, NULL otherwise
Reference# targetPeel Sync Experimental
var oid = reference . targetPeel ( ) ;
Returns
Oid
the oid if available, NULL otherwise
var string = reference . toString ( ) ;
Returns the name of the reference.
Reference# type Sync Experimental
var result = reference . type ( ) ;
| Flag | Value |
| --- | --- | --- |
| Reference.FORMAT. NORMAL | 0 |
| Reference.FORMAT. ALLOW_ONELEVEL | 1 |
| Reference.FORMAT. REFSPEC_PATTERN | 2 |
| Reference.FORMAT. REFSPEC_SHORTHAND | 4 |
| Flag | Value |
| --- | --- | --- |
| Reference.TYPE. INVALID | 0 |
| Reference.TYPE. DIRECT | 1 |
| Reference.TYPE. SYMBOLIC | 2 |
| Reference.TYPE. ALL | 3 |