Skip to content

Latest commit

 

History

History
253 lines (197 loc) · 7.02 KB

File metadata and controls

253 lines (197 loc) · 7.02 KB
layout default
menu_item api
title Branch
description Version 0.26.1
return_to
API Documentation Index
/api/
sections
create createFromAnnotated delete isCheckedOut isHead lookup move name remoteName setUpstream upstream upstreamName upstreamRemote BRANCH
#create
#createFromAnnotated
#delete
#isCheckedOut
#isHead
#lookup
#move
#name
#remoteName
#setUpstream
#upstream
#upstreamName
#upstreamRemote
#BRANCH

Branch.create Async

Branch.create(repo, branch_name, target, force).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository
branch_name String Name for the branch; this name is validated for consistency. It should also not conflict with an already existing branch name.
target Commit Commit to which this branch should point. This object must belong to the given repo.
force Number Overwrite existing branch.
Returns
Reference the underlying reference.

Branch.createFromAnnotated Async

Branch.createFromAnnotated(repository, branch_name, commit, force).then(function(reference) {
  // Use reference
});
Parameters Type
repository Repository
branch_name String
commit AnnotatedCommit
force Number
Returns
Reference

Branch.delete Sync

var result = Branch.delete(branch);
Parameters Type
branch Reference A valid reference representing a branch
Returns
Number 0 on success, or an error code.

Branch.isCheckedOut Sync

var result = Branch.isCheckedOut(branch);
Parameters Type
branch Reference Reference to the branch.
Returns
Number 1 if branch is checked out, 0 if it isn't,
error code otherwise.

Branch.isHead Sync

var result = Branch.isHead(branch);
Parameters Type
branch Reference Current underlying reference of the branch.
Returns
Number 1 if HEAD points at the branch, 0 if it isn't,
error code otherwise.

Branch.lookup Async

Branch.lookup(repo, branch_name, branch_type).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository the repository to look up the branch
branch_name String Name of the branch to be looked-up; this name is validated for consistency.
branch_type Number Type of the considered branch. This should be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
Returns
Reference

Branch.move Async

Branch.move(branch, new_branch_name, force).then(function(reference) {
  // Use reference
});
Parameters Type
branch Reference Current underlying reference of the branch.
new_branch_name String Target name of the branch once the move is performed; this name is validated for consistency.
force Number Overwrite existing branch.
Returns
Reference

Branch.name Async

Branch.name(ref).then(function(string) {
  // Use string
});
Parameters Type
ref Reference the reference ideally pointing to a branch
Returns
String

Branch.remoteName Async

Branch.remoteName(repo, the).then(function(string) {
  // Use string
});

Retrieve the Branch's Remote Name as a String.

Parameters Type
repo Repository The repo to get the remote name from
the String refname of the branch
Returns
String remote name as a string.

Branch.setUpstream Async

Branch.setUpstream(branch, upstream_name).then(function(result) {
  // Use result
});
Parameters Type
branch Reference the branch to configure
upstream_name String remote-tracking or local branch to set as upstream. Pass NULL to unset.
Returns
Number 0 or an error code

Branch.upstream Async

Branch.upstream(branch).then(function(reference) {
  // Use reference
});
Parameters Type
branch Reference Current underlying reference of the branch.
Returns
Reference the retrieved
reference.

Branch.upstreamName Async

Branch.upstreamName(repo, refname).then(function(buf) {
  // Use buf
});
Parameters Type
repo Repository the repository where the branches live
refname String reference name of the local branch.
Returns
Buf

Branch.upstreamRemote Sync

var result = Branch.upstreamRemote(buf, repo, refname);
Parameters Type
buf Buf the buffer into which to write the name
repo Repository the repository in which to look
refname String the full name of the branch
Returns
Number 0 or an error code

Branch.BRANCH ENUM

| Flag | Value | | --- | --- | --- | | Branch.BRANCH.LOCAL | 1 | | Branch.BRANCH.REMOTE | 2 | | Branch.BRANCH.ALL | 3 |