<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Branches API > 原文:[https://docs.gitlab.com/ee/api/branches.html](https://docs.gitlab.com/ee/api/branches.html) * [List repository branches](#list-repository-branches) * [Get single repository branch](#get-single-repository-branch) * [Protect repository branch](#protect-repository-branch) * [Unprotect repository branch](#unprotect-repository-branch) * [Create repository branch](#create-repository-branch) * [Delete repository branch](#delete-repository-branch) * [Delete merged branches](#delete-merged-branches) # Branches API[](#branches-api "Permalink") 該 API 在[存儲庫分支上運行](../user/project/repository/branches/index.html) . **提示:**另請參閱[受保護的分支機構 API](protected_branches.html) . ## List repository branches[](#list-repository-branches "Permalink") 從項目中獲取存儲庫分支的列表,按名稱的字母順序排序. **注意:**如果可公開訪問該存儲庫,則無需身份驗證即可訪問此端點. ``` GET /projects/:id/repository/branches ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 身份驗證用戶擁有[的項目的](README.html#namespaced-path-encoding) ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) . | | `search` | string | no | 返回包含搜索字符串的分支列表. 您可以使用`^term`和`term$`查找分別以`term`開頭和結尾的分支. | 請求示例: ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/branches" ``` 響應示例: ``` [ { "name": "master", "merged": false, "protected": true, "default": true, "developers_can_push": false, "developers_can_merge": false, "can_push": true, "web_url": "http://gitlab.example.com/my-group/my-project/-/tree/master", "commit": { "author_email": "john@example.com", "author_name": "John Smith", "authored_date": "2012-06-27T05:51:39-07:00", "committed_date": "2012-06-28T03:44:20-07:00", "committer_email": "john@example.com", "committer_name": "John Smith", "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", "short_id": "7b5c3cc", "title": "add projects API", "message": "add projects API", "parent_ids": [ "4ad91d3c1144c406e50c7b33bae684bd6837faf8" ] } }, ... ] ``` ## Get single repository branch[](#get-single-repository-branch "Permalink") 獲取單個項目存儲庫分支. **注意:**如果可公開訪問該存儲庫,則無需身份驗證即可訪問此端點. ``` GET /projects/:id/repository/branches/:branch ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 身份驗證用戶擁有[的項目的](README.html#namespaced-path-encoding) ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) . | | `branch` | string | yes | 分支名稱. | 請求示例: ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/branches/master" ``` 響應示例: ``` { "name": "master", "merged": false, "protected": true, "default": true, "developers_can_push": false, "developers_can_merge": false, "can_push": true, "web_url": "http://gitlab.example.com/my-group/my-project/-/tree/master", "commit": { "author_email": "john@example.com", "author_name": "John Smith", "authored_date": "2012-06-27T05:51:39-07:00", "committed_date": "2012-06-28T03:44:20-07:00", "committer_email": "john@example.com", "committer_name": "John Smith", "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", "short_id": "7b5c3cc", "title": "add projects API", "message": "add projects API", "parent_ids": [ "4ad91d3c1144c406e50c7b33bae684bd6837faf8" ] } } ``` ## Protect repository branch[](#protect-repository-branch "Permalink") 有關保護存儲庫分支的信息,請參見[`POST /projects/:id/protected_branches`](protected_branches.html#protect-repository-branches) . ## Unprotect repository branch[](#unprotect-repository-branch "Permalink") 有關取消保護存儲庫分支的信息,請參見[`DELETE /projects/:id/protected_branches/:name`](protected_branches.html#unprotect-repository-branches) . ## Create repository branch[](#create-repository-branch "Permalink") 在存儲庫中創建一個新分支. ``` POST /projects/:id/repository/branches ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer | yes | 身份驗證用戶擁有[的項目的](README.html#namespaced-path-encoding) ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) . | | `branch` | string | yes | 分支名稱. | | `ref` | string | yes | 分支名稱或提交 SHA 以從中創建分支. | 請求示例: ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/branches?branch=newbranch&ref=master" ``` 響應示例: ``` { "commit": { "author_email": "john@example.com", "author_name": "John Smith", "authored_date": "2012-06-27T05:51:39-07:00", "committed_date": "2012-06-28T03:44:20-07:00", "committer_email": "john@example.com", "committer_name": "John Smith", "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", "short_id": "7b5c3cc", "title": "add projects API", "message": "add projects API", "parent_ids": [ "4ad91d3c1144c406e50c7b33bae684bd6837faf8" ] }, "name": "newbranch", "merged": false, "protected": false, "default": false, "developers_can_push": false, "developers_can_merge": false, "can_push": true, "web_url": "http://gitlab.example.com/my-group/my-project/-/tree/newbranch" } ``` ## Delete repository branch[](#delete-repository-branch "Permalink") 從存儲庫中刪除一個分支. **注意:**如果發生錯誤,將提供說明消息. ``` DELETE /projects/:id/repository/branches/:branch ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 身份驗證用戶擁有[的項目的](README.html#namespaced-path-encoding) ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) . | | `branch` | string | yes | 分支名稱. | 請求示例: ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/branches/newbranch" ``` ## Delete merged branches[](#delete-merged-branches "Permalink") Will delete all branches that are merged into the project’s default branch. **注意:**此操作不會刪除[受保護的分支](../user/project/protected_branches.html) . ``` DELETE /projects/:id/repository/merged_branches ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 身份驗證用戶擁有[的項目的](README.html#namespaced-path-encoding) ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) . | 請求示例: ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/merged_branches" ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看