GET

Get git latest projects {projectKey} repos {repositorySlug} pull-requests {pullRequestId} rebase

Checks preconditions to determine whether the pull request can be rebased.

Some of the preconditions are:

  • The pull request is between Git repositories
  • The pull request is currently open
  • The pull request's {@link PullRequest#getFromRef "from" ref} is a branch
    • In other words, the qualified ID for the "from" ref must start with refs/heads/
    • Tags, and other non-standard refs, cannot be rebased
  • The current user has an e-mail address
    • Pull requests cannot be rebased anonymously
    • git rebase records the current user as the committer for the rebased commits, which requires a name and e-mail address
  • The current user has write access to the {@link PullRequest#getFromRef "from" ref}'s repository
    • Note that in order to view a pull request a user is only required to have read access to the {@link PullRequest#getToRef toRef}'s repository, so just because a user can see a pull request does not mean they can request a rebase

This list is not exhaustive, and the exact set of preconditions applied can be extended by third-party add-ons.

The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.

Request

Path parameters

projectKey

string

Required
pullRequestId

string

Required
repositorySlug

string

Required

Responses

The rebaseability status of the pull request.

application/json

RestPullRequestRebaseability
GET/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "vetoes": [ { "detailedMessage": "You have insufficient permissions to rebase 'refs/heads/feature-branch'.", "summaryMessage": "Insufficient branch permissions" } ] }
POST

Post git latest projects {projectKey} repos {repositorySlug} pull-requests {pullRequestId} rebase

Rebases the specified pull request, rewriting the incoming commits to start from the tip commit of the pull request's target branch. This operation alters the pull request's source branch and cannot be undone.

The authenticated user must have REPO_READ permission for the repository that this pull request targets and REPO_WRITE permission for the pull request's source repository to call this resource.

Request

Path parameters

projectKey

string

Required
pullRequestId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The pull request rebase request.

version

integer

Responses

The merged pull request.

application/json

RestPullRequestRebaseResult
POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "version": 1 }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 { "refChange": { "fromHash": "6053a1eaa1c009dd11092d09a72f3c41af1b59ad", "toHash": "d6edcbf924697ab811a867421dab60d954ccad99", "refId": "refs/heads/master", "type": "ADD", "ref": { "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" } } }
POST

Post git latest projects {projectKey} repos {repositorySlug} tags

Creates a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The create git tag request.

force

boolean

message

string

name

string

startPoint

string

type

string

Responses

A JSON representation of the newly created tag.

application/json

RestTag
POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 4 5 6 7 8 9 10 11 curl --request POST \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "force": true, "message": "A new release tag", "name": "release-tag", "startPoint": "refs/heads/master", "type": "ANNOTATED" }'
201Response
1 2 3 4 5 6 7 8 { "hash": "8d51122def5632836d1cb1026e879069e10a1e13", "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }
DEL

Delete git latest projects {projectKey} repos {repositorySlug} tags {name}

Deletes a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

Request

Path parameters

projectKey

string

Required
name

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the tag no longer exists in the repository.

DEL/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}'

Rate this page: