Share via


Refs - Update Refs

refs(분기)를 만들거나 업데이트하거나 삭제합니다.

ref를 업데이트한다는 것은 참조가 예전과 다른 커밋을 가리키도록 하는 것을 의미합니다. 경합 상태를 방지하려면 이전 커밋과 새 커밋을 모두 지정해야 합니다.

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?api-version=7.1-preview.1
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?projectId={projectId}&api-version=7.1-preview.1

URI 매개 변수

Name In(다음 안에) 필수 형식 Description
organization
path True

string

Azure DevOps 조직의 이름입니다.

repositoryId
path True

string

리포지토리의 이름 또는 ID입니다.

project
path

string

프로젝트 ID 또는 프로젝트 이름

api-version
query True

string

사용할 API의 버전입니다. 이 버전의 API를 사용하려면 '7.1-preview.1'로 설정해야 합니다.

projectId
query

string

팀 프로젝트의 ID 또는 이름입니다. 리포지토리에 대한 ID를 지정하는 경우 선택 사항입니다.

요청 본문

Name 형식 Description
body

GitRefUpdate[]

수행할 ref 업데이트 목록

응답

Name 형식 Description
200 OK

GitRefUpdateResult[]

성공적인 작업

보안

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.code_write 소스 코드를 읽고, 업데이트하고, 삭제하고, 커밋, 변경 집합, 분기 및 기타 버전 제어 아티팩트에 대한 메타데이터에 액세스하는 기능을 부여합니다. 또한 끌어오기 요청 및 코드 검토를 만들고 관리하고 서비스 후크를 통해 버전 제어 이벤트에 대한 알림을 받을 수 있는 기능을 부여합니다.

예제

Create/Update/Delete a ref by repositoryId

Sample Request

POST https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/refs?api-version=7.1-preview.1

[
  {
    "name": "refs/heads/vsts-api-sample/answer-woman-flame",
    "oldObjectId": "0000000000000000000000000000000000000000",
    "newObjectId": "ffe9cba521f00d7f60e322845072238635edb451"
  }
]

Sample Response

transfer-Encoding: chunked
{
  "value": [
    {
      "repositoryId": "d3d1760b-311c-4175-a726-20dfc6a7f885",
      "name": "refs/heads/vsts-api-sample/answer-woman-flame",
      "oldObjectId": "0000000000000000000000000000000000000000",
      "newObjectId": "ffe9cba521f00d7f60e322845072238635edb451",
      "isLocked": false,
      "updateStatus": "succeeded",
      "success": true
    }
  ],
  "count": 1
}

정의

Name Description
GitRefUpdate
GitRefUpdateResult
GitRefUpdateStatus

TFS 서버의 업데이트 상태입니다.

GitRefUpdate

Name 형식 Description
isLocked

boolean

name

string

newObjectId

string

oldObjectId

string

repositoryId

string

GitRefUpdateResult

Name 형식 Description
customMessage

string

결과 개체에 대한 사용자 지정 메시지 instance, 실패 이유입니다.

isLocked

boolean

ref가 잠겨 있는지 여부

name

string

참조 이름

newObjectId

string

새 개체 ID

oldObjectId

string

이전 개체 ID

rejectedBy

string

업데이트된 를 거부한 플러그 인의 이름입니다.

repositoryId

string

리포지토리 ID

success

boolean

ref 업데이트가 성공하면 True, 그렇지 않으면 false입니다.

updateStatus

GitRefUpdateStatus

TFS 서버의 업데이트 상태입니다.

GitRefUpdateStatus

TFS 서버의 업데이트 상태입니다.

Name 형식 Description
createBranchPermissionRequired

string

사용자가 분기를 만들 수 있는 권한이 없기 때문에 ref 업데이트 요청을 완료할 수 없습니다.

createTagPermissionRequired

string

사용자가 태그를 만들 수 있는 권한이 없기 때문에 ref 업데이트 요청을 완료할 수 없습니다.

forcePushRequired

string

이 변경으로 인해 그래프의 일부가 연결이 끊어지고 호출자에게 리포지토리에 대한 ForcePush 권한이 없으므로 ref 업데이트 요청을 완료할 수 없음을 나타냅니다.

invalidRefName

string

요청에 표시된 참조 이름이 잘못되었기 때문에 ref 업데이트 요청을 완료할 수 없음을 나타냅니다.

locked

string

ref가 다른 사용자에 의해 잠겨 있으므로 ref 업데이트를 완료할 수 없습니다.

manageNotePermissionRequired

string

사용자에게 이 메모를 작성하는 데 필요한 메모 만들기 권한이 없기 때문에 ref 업데이트 요청을 완료할 수 없습니다.

refNameConflict

string

대/소문자를 구분하지 않는 모드에서 ref 이름이 서로 다른 기존 참조 이름과 충돌하기 때문에 ref 업데이트를 완료할 수 없습니다.

rejectedByPlugin

string

ref 업데이트가 플러그 인에 의해 거부되었기 때문에 완료할 수 없습니다.

rejectedByPolicy

string

정책에 의해 거부되었으므로 ref 업데이트를 완료할 수 없습니다.

staleOldObjectId

string

데이터베이스가 업데이트를 시도할 때 요청에 제공된 이전 개체 ID가 ref의 개체 ID가 아니므로 ref 업데이트 요청을 완료할 수 없음을 나타냅니다. 가장 가능성이 높은 시나리오는 호출자가 심판을 업데이트하기 위한 경합을 잃었다는 것입니다.

succeeded

string

ref 업데이트 요청이 성공적으로 완료되었음을 나타냅니다.

succeededCorruptRef

string

ref 업데이트 요청이 성공적으로 완료되었지만 전달된 ref가 손상되었음을 나타냅니다. 이전 개체 ID가 잘못되었습니다. 삭제하는 동안에만 발생합니다.

succeededNonExistentRef

string

ref 업데이트 요청이 성공적으로 완료되었지만 ref가 실제로 존재하지 않으므로 변경되지 않음을 나타냅니다. 삭제하는 동안에만 발생합니다.

unprocessed

string

요청이 처리되지 않았습니다.

unresolvableToCommit

string

ref에 대한 새 개체 ID를 커밋 개체로 확인할 수 없기 때문에 ref 업데이트 요청을 완료할 수 없습니다(잠재적으로 태그 수를 통해).

writePermissionRequired

string

사용자가 이 참조를 작성하는 데 필요한 쓰기 권한이 없기 때문에 ref 업데이트 요청을 완료할 수 없습니다.