更新提取請求 - AWS CodeCommit

AWS CodeCommit 不再提供給新客戶。的現有客戶 AWS CodeCommit 可以繼續正常使用服務。進一步了解」

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

更新提取請求

您可以透過將遞交推送至開啟的提取請求的來源分支,以更新具有進一步程式碼變更的提取請求。如需詳細資訊,請參閱在 中建立遞交 AWS CodeCommit

您可以使用 AWS CodeCommit 主控台或 AWS CLI 來更新提取請求的標題或描述。您可能想要更新提取請求標題或描述,因為:

  • 其他使用者無法了解描述,或原始標題會誤導。

  • 您希望標頭或描述能反映對開啟中提取請求的來源分支進行的變更。

更新提取請求 (主控台)

您可以使用 CodeCommit 主控台來更新 CodeCommit 儲存庫中提取請求的標題和描述。若要更新提取請求中的程式碼,請將遞交推送至開啟提取請求的來源分支。

  1. 開啟 CodeCommit 主控台,網址為 https://https://console.aws.amazon.com/codesuite/codecommit/home

  2. Repositories (儲存庫) 中,選擇您要更新提取請求所在儲存庫的名稱。

  3. 在導覽窗格中,選擇 Pull requests (提取請求)

  4. 依預設,會顯示所有開啟的提取請求清單。選擇您想要更新的開啟中提取請求。

  5. 在提取請求中,選擇 Details (詳細資訊),然後選擇 Edit details (編輯詳細資訊),以編輯標題或描述。

    注意

    您無法更新已關閉或合併的提取請求的標題或描述。

更新提取請求 (AWS CLI)

若要搭配 CodeCommit 使用 AWS CLI 命令,請安裝 AWS CLI。如需詳細資訊,請參閱命令列參考

您可能也想要了解下列命令:

使用 AWS CLI 在 CodeCommit 儲存庫中更新提取請求

  1. 若要更新儲存庫中提取請求的標題,請執行 update-pull-request-title 命令,指定:

    • 提取請求的 ID (使用 --pull-request-id 選項)。

    • 提取請求的標題 (使用 --title 選項)。

    例如,若要更新 ID 為 47 提取請求的標題:

    aws codecommit update-pull-request-title --pull-request-id 47 --title "Consolidation of global variables - updated review"

    如果此命令成功執行,您會看到類似如下的輸出產生:

    { "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "originApprovalRuleTemplate": { "approvalRuleTemplateId": "dd8b26gr-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.12, "description": "Review the latest changes and updates to the global variables. I have updated this request with some changes, including removing some unused variables.", "lastActivityDate": 1508372657.188, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables - updated review" } }
  2. 若要更新提取請求的描述,請執行 update-pull-request-description 命令,指定:

    • 提取請求的 ID (使用 --pull-request-id 選項)。

    • 描述 (使用 --description 選項)。

    例如,若要更新 ID 為 47 提取請求的描述:

    aws codecommit update-pull-request-description --pull-request-id 47 --description "Updated the pull request to remove unused global variable."

    如果此命令成功執行,您會看到類似如下的輸出產生:

    { "pullRequest": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.155, "description": "Updated the pull request to remove unused global variable.", "lastActivityDate": 1508372423.204, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }