diff --git a/doc/user/project/merge_requests/creating_merge_requests.md b/doc/user/project/merge_requests/creating_merge_requests.md index d704e9fa5d1edd169855254d8b102e7e22e71b95..4ea549e5986f7b4a9118c78c6b200c4cb108ee0a 100644 --- a/doc/user/project/merge_requests/creating_merge_requests.md +++ b/doc/user/project/merge_requests/creating_merge_requests.md @@ -11,7 +11,7 @@ disqus_identifier: 'https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.h There are many different ways to create a merge request. NOTE: -Use [branch naming patterns](../repository/branches/index.md#naming) to streamline merge request creation. +Use [branch naming patterns](../repository/branches/index.md#prefix-branch-names-with-issue-numbers) to streamline merge request creation. ## From the merge request list diff --git a/doc/user/project/repository/branches/img/branch_filter_search_box_v13_12.png b/doc/user/project/repository/branches/img/branch_filter_search_box_v13_12.png deleted file mode 100644 index a1cf9f10122a386cd4e0ff47b401a863af880548..0000000000000000000000000000000000000000 Binary files a/doc/user/project/repository/branches/img/branch_filter_search_box_v13_12.png and /dev/null differ diff --git a/doc/user/project/repository/branches/img/compare_branches_v13_12.png b/doc/user/project/repository/branches/img/compare_branches_v13_12.png deleted file mode 100644 index 296274067298ae81cd8bf2dff9546efb014526f6..0000000000000000000000000000000000000000 Binary files a/doc/user/project/repository/branches/img/compare_branches_v13_12.png and /dev/null differ diff --git a/doc/user/project/repository/branches/img/repository_filter_search_box_v13_12.png b/doc/user/project/repository/branches/img/repository_filter_search_box_v13_12.png deleted file mode 100644 index 230abf0d875550034f43d527df2996abef96b57c..0000000000000000000000000000000000000000 Binary files a/doc/user/project/repository/branches/img/repository_filter_search_box_v13_12.png and /dev/null differ diff --git a/doc/user/project/repository/branches/img/swap_revisions_after_v13_12.png b/doc/user/project/repository/branches/img/swap_revisions_after_v13_12.png deleted file mode 100644 index 7eb10d1093873dee2c6e1c738ac53fcfa3988b22..0000000000000000000000000000000000000000 Binary files a/doc/user/project/repository/branches/img/swap_revisions_after_v13_12.png and /dev/null differ diff --git a/doc/user/project/repository/branches/img/swap_revisions_before_v13_12.png b/doc/user/project/repository/branches/img/swap_revisions_before_v13_12.png deleted file mode 100644 index f92c42798714d8b3dfaec1fc46da79ec14bc2137..0000000000000000000000000000000000000000 Binary files a/doc/user/project/repository/branches/img/swap_revisions_before_v13_12.png and /dev/null differ diff --git a/doc/user/project/repository/branches/index.md b/doc/user/project/repository/branches/index.md index 60504b9450207ff0fb3b1e4749d223568f79aff5..8169956c02eea77738e07c558c5e552cc81832bf 100644 --- a/doc/user/project/repository/branches/index.md +++ b/doc/user/project/repository/branches/index.md @@ -14,7 +14,7 @@ other. After pushing your changes to a new branch, you can: - Create a [merge request](../../merge_requests/index.md). You can streamline this process - by following [branch naming patterns](#naming). + by following [branch naming patterns](#prefix-branch-names-with-issue-numbers). - Perform inline code review. - [Discuss](../../../discussions/index.md) your implementation with your team. - Preview changes submitted to a new branch with [Review Apps](../../../../ci/review_apps/index.md). @@ -30,7 +30,6 @@ For more information on managing branches using the GitLab UI, see: - [Create a branch](../web_editor.md#create-a-branch) - [Protected branches](../../protected_branches.md#protected-branches) - [Delete merged branches](#delete-merged-branches) -- [Branch filter search box](#branch-filter-search-box) You can also manage branches using the [command line](../../../../gitlab-basics/start-using-git.md#create-a-branch). @@ -43,29 +42,36 @@ See also: - [GitLab Flow](../../../../topics/gitlab_flow.md) documentation. - [Getting started with Git](../../../../topics/git/index.md) and GitLab. -## Naming +## Prefix branch names with issue numbers -Prefix a branch name with an issue number to streamline merge request creation. -When you create a merge request for a branch with a name beginning with an issue -number, GitLab: +To streamline the creation of merge requests, start your branch name with an +issue number. GitLab uses the issue number to import data into the merge request: -- Marks the issue as related. If your project is configured with a +- The issue is marked as related. The issue and merge request display links to each other. +- If your project is configured with a [default closing pattern](../../issues/managing_issues.md#default-closing-pattern), - merging this merge request [also closes](../../issues/managing_issues.md#closing-issues-automatically) + merging the merge request [also closes](../../issues/managing_issues.md#closing-issues-automatically) the related issue. -- Copies label and milestone metadata from the issue. +- The issue milestone and labels are copied to the merge request. -## Compare +## Compare branches -To compare branches in a repository: +> - Repository filter search box [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52967) in GitLab 13.10. +> - Revision swapping [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60491) in GitLab 13.12. -1. Navigate to your project's repository. -1. Select **Repository > Compare** in the sidebar. -1. Select the target repository to compare with the [repository filter search box](#repository-filter-search-box). -1. Select branches to compare using the [branch filter search box](#branch-filter-search-box). -1. Select **Compare** to view the changes inline: +To compare branches in a repository: -  +1. On the top bar, select **Main menu > Projects** and find your project. +1. On the left sidebar, select **Repository > Compare**. +1. Select the **Source** branch to search for your desired branch. Exact matches are + shown first. You can refine your search with operators: + - `^` matches the beginning of the branch name: `^feat` matches `feat/user-authentication`. + - `$` matches the end of the branch name: `widget$` matches `feat/search-box-widget`. + - `*` matches using a wildcard: `branch*cache*` matches `fix/branch-search-cache-expiration`. + - You can combine operators: `^chore/*migration$` matches `chore/user-data-migration`. +1. Select the **Target** repository and branch. Exact matches are shown first. +1. Select **Compare** to show the list of commits, and changed files. To reverse + the **Source** and **Target**, select **Swap revisions**. ## Delete merged branches @@ -79,46 +85,6 @@ this operation. It's particularly useful to clean up old branches that were not deleted automatically when a merge request was merged. -## Repository filter search box - -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52967) in GitLab 13.10. - -This feature allows you to search and select a repository quickly when [comparing branches](#compare). - - - -Search results appear in the following order: - -- Repositories with names exactly matching the search terms. -- Other repositories with names that include search terms, sorted alphabetically. - -## Branch filter search box - - - -This feature allows you to search and select branches quickly. Search results appear in the following order: - -- Branches with names that matched search terms exactly. -- Other branches with names that include search terms, sorted alphabetically. - -Sometimes when you have hundreds of branches you may want a more flexible matching pattern. In such cases you can use the following operators: - -- `^` matches beginning of branch name, for example `^feat` would match `feat/user-authentication` -- `$` matches end of branch name, for example `widget$` would match `feat/search-box-widget` -- `*` wildcard matcher, for example `branch*cache*` would match `fix/branch-search-cache-expiration` - -These operators can be mixed, for example `^chore/*migration$` would match `chore/user-data-migration` - -## Swap revisions - -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60491) in GitLab 13.12. - - - -The Swap revisions feature allows you to swap the Source and Target revisions. When the Swap revisions button is selected, the selected revisions for Source and Target is swapped. - - - ## View branches with configured protections **(FREE SELF)** > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 15.1 with a flag named `branch_rules`. Disabled by default. @@ -143,6 +109,12 @@ To view the **Branch rules overview** list: - [Approval rules](../../merge_requests/approvals/rules.md). - [Status checks](../../merge_requests/status_checks.md). +## Related topics + +- [Protected branches](../../protected_branches.md) user documentation +- [Branches API](../../../../api/branches.md) +- [Protected Branches API](../../../../api/protected_branches.md) + ## Troubleshooting ### Multiple branches containing the same commit