Checkout New Git Branch

Version 4.0.24.16

Create and Checkout a Git Branch

Creates and checks out a new branch in the given project repository Only allowed in development mode

  • Call update_session to select the 'dev' workspace.

Optionally specify a branch name, tag name or commit SHA as the start point in the ref field. If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.

Request

POST /projects/{project_id}/git_branch
Datatype
Description
Request
HTTP Request
path
HTTP Path
Expand HTTP Path definition...
project_id
string
Project Id
body
HTTP Body
Expand HTTP Body definition...
body
Git Branch
Expand GitBranch definition...
can
object
Operations the current user is able to perform on this object
name
string
The short name on the local. Updating `name` results in `git checkout `
remote
string
The name of the remote
remote_name
string
The short name on the remote
error
string
Name of error
message
string
Message describing an error if present
owner_name
string
Name of the owner of a personal branch
readonly
boolean
Whether or not this branch is readonly
personal
boolean
Whether or not this branch is a personal branch - readonly for all developers except the owner
is_local
boolean
Whether or not a local ref exists for the branch
is_remote
boolean
Whether or not a remote ref exists for the branch
is_production
boolean
Whether or not this is the production branch
ahead_count
integer
Number of commits the local branch is ahead of the remote
behind_count
integer
Number of commits the local branch is behind the remote
commit_at
integer
UNIX timestamp at which this branch was last committed.
ref
string
The resolved ref of this branch. Updating `ref` results in `git reset --hard ``.
remote_ref
string
The resolved ref of this branch remote.

Response

200: Git Branch

Datatype
Description
(object)
can
object
Operations the current user is able to perform on this object
name
string
The short name on the local. Updating `name` results in `git checkout `
remote
string
The name of the remote
remote_name
string
The short name on the remote
error
string
Name of error
message
string
Message describing an error if present
owner_name
string
Name of the owner of a personal branch
readonly
boolean
Whether or not this branch is readonly
personal
boolean
Whether or not this branch is a personal branch - readonly for all developers except the owner
is_local
boolean
Whether or not a local ref exists for the branch
is_remote
boolean
Whether or not a remote ref exists for the branch
is_production
boolean
Whether or not this is the production branch
ahead_count
integer
Number of commits the local branch is ahead of the remote
behind_count
integer
Number of commits the local branch is behind the remote
commit_at
integer
UNIX timestamp at which this branch was last committed.
ref
string
The resolved ref of this branch. Updating `ref` results in `git reset --hard ``.
remote_ref
string
The resolved ref of this branch remote.

400: Bad Request

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

404: Not Found

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

409: Resource Already Exists

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

422: Validation Error

Datatype
Description
(object)
message
string
Error details
Expand ValidationErrorDetail definition...
field
string
Field with error
code
string
Error code
message
string
Error info message
documentation_url
string
Documentation link
documentation_url
string
Documentation link

429: Too Many Requests

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link