Assignee gitlab что это
Перейти к содержимому

Assignee gitlab что это

  • автор:

Assignee, approver, reviewer, oh my!

Picture of Horst Gutmann

Horst Gutmann, software engineer from Graz , Austria .

I’m working daily with GitLab and absolutely love it. When it comes to all the different roles that a person can have around issues and merge requests, though, I sometimes get confused and so I thought I’d finally write them down so that even I can remember:

Assignee

Each merge request and issue can have one or multiple users assigned to it. That assignment can change during the life-time of that item but in both contexts these are the people to contact if there are questions about that MR or issue.

Merge request author

In the context of merge requests there is also always an author. That’s the user that initially created the merge request. As far as I can tell, this attribute of an MR cannot be changed while assignees can.

Approver/Reviewers

A reviewer is someone who you want to review your merge request. Actually, you want that they approve your merge request which makes them an “approver”. That’s confusing… let’s work with a little example:

Let’s say you’re the maintainer of ProjectX. This means that whenever a new merge request is opened, you should be automatically assigned as reviewer so that nobody can merge it without you giving it an approval first!

To do that, you create an “approval rule” within your project that set the number of approvals required to “1” and add yourself to the list of “approvers”.

OK, but that only decides who’s approval is required for an MR. If you want to explicitly request a review from someone, you can now add them to a merge request as a “reviewer”. Once you are added to an MR as a reviewer, you can also find that request in the quick menu in GitLab’s top bar:

Screenshot of the GitLab top bar with expanded merge-request menu

Once you are a review of an MR, you can easily navigate to it using the top bar menu

Code owner

Related to approvers are code owners. These are defined inside the CODEOWNERS file within the repository and indicate which people are responsible for which part of the repository. GitLab can add these people to the required approvers if code that’s under their responsibility would be changed by a MR. This feature can be configured for protected branches.

I think that’s basically it for now. Personally, I think the whole approver vs. reviewer naming is a bit unfortunate but otherwise everything is pretty clear once you’ve understood what each role is there for ��

Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.

Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link ��

Comments

If you have a Mastodon account, you can also leave a comment by replying to this status.

You can also find this post linked to from the following pages:

Creative Commons License

(cc) 2003-2023 Horst Gutmann | /feeds

If not otherwise stated this work is licensed under a Creative Commons Attribution-Share Alike 3.0 Austria License.
The source code of this site is available on GitHub. The primary font used here is Liberation Mono by Red Hat.

Getting started with merge requests (FREE)

A merge request (MR) is the basis of GitLab as a code collaboration and version control.

When working in a Git-based platform, you can use branching strategies to collaborate on code.

A repository is composed by its default branch, which contains the major version of the codebase, from which you create minor branches, also called feature branches, to propose changes to the codebase without introducing them directly into the major version of the codebase.

Branching is especially important when collaborating with others, avoiding changes to be pushed directly to the default branch without prior reviews, tests, and approvals.

When you create a new feature branch, change the files, and push it to GitLab, you have the option to create a merge request, which is essentially a request to merge one branch into another.

The branch you added your changes into is called source branch while the branch you request to merge your changes into is called target branch.

The target branch can be the default or any other branch, depending on the branching strategies you choose.

In a merge request, beyond visualizing the differences between the original content and your proposed changes, you can execute a significant number of tasks before concluding your work and merging the merge request.

You can watch our GitLab Flow video for a quick overview of working with merge requests.

How to create a merge request

Learn the various ways to create a merge request.

What you can do with merge requests

When you start a new merge request, you can immediately include the following options, or add them later by clicking the Edit button on the merge request’s page at the top-right side:

  • Assign the merge request to a colleague for review. With multiple assignees, you can assign it to more than one person at a time.
  • Set a milestone to track time-sensitive changes.
  • Add labels to help contextualize and filter your merge requests over time.
  • Require approval from your team. (PREMIUM)
  • Close issues automatically when they are merged.
  • Enable the delete source branch when merge request is accepted option to keep your repository clean.
  • Enable the squash commits when merge request is accepted option to combine all the commits into one before merging, thus keep a clean commit history in your repository.
  • Set the merge request as a Draft to avoid accidental merges before it is ready.

After you have created the merge request, you can also:

  • Discuss your implementation with your team in the merge request thread.
  • Perform inline code reviews.
  • Add merge request dependencies to restrict it to be merged only when other merge requests have been merged. (PREMIUM)
  • Preview continuous integration pipelines on the merge request widget.
  • Preview how your changes look directly on your deployed application with Review Apps.
  • Allow collaboration on merge requests across forks.
  • Perform a Review to create multiple comments on a diff and publish them when you’re ready.
  • Add code suggestions to change the content of merge requests directly into merge request threads, and easily apply them to the codebase directly from the UI.
  • Add a time estimation and the time spent with that merge request with Time Tracking.

Many of these can be set when pushing changes from the command line, with Git push options.

Assignee

Choose an assignee to designate someone as the person responsible for the first review of the merge request. Open the drop down box to search for the user you wish to assign, and the merge request is added to their assigned merge request list.

Multiple assignees (PREMIUM)
  • Introduced in GitLab 11.11.
  • Moved to GitLab Premium in 13.9

Multiple people often review merge requests at the same time. GitLab allows you to have multiple assignees for merge requests to indicate everyone that is reviewing or accountable for it.

multiple assignees for merge requests sidebar

To assign multiple assignees to a merge request:

  1. From a merge request, expand the right sidebar and locate the Assignees section.
  2. Click on Edit and from the dropdown menu, select as many users as you want to assign the merge request to.

Similarly, assignees are removed by deselecting them from the same dropdown menu.

It is also possible to manage multiple assignees:

  • When creating a merge request.
  • Using quick actions.

Reviewer

WARNING: Requesting a code review is an important part of contributing code. However, deciding who should review your code and asking for a review are no easy tasks. Using the «assignee» field for both authors and reviewers makes it hard for others to determine who’s doing what on a merge request.

The merge request Reviewers feature enables you to request a review of your work, and see the status of the review. Reviewers help distinguish the roles of the users involved in the merge request. In comparison to an Assignee, who is directly responsible for creating or merging a merge request, a Reviewer is a team member who may only be involved in one aspect of the merge request, such as a peer review.

To request a review of a merge request, expand the Reviewers select box in the right-hand sidebar. Search for the users you want to request a review from. When selected, GitLab creates a to-do list item for each reviewer.

Merge requests to close issues

If the merge request is being created to resolve an issue, you can add a note in the description which sets it to automatically close the issue when merged.

If the issue is confidential, you may want to use a different workflow for merge requests for confidential issues to prevent confidential information from being exposed.

Deleting the source branch

When creating a merge request, select the Delete source branch when merge request accepted option, and the source branch is deleted when the merge request is merged. To make this option enabled by default for all new merge requests, enable it in the project’s settings.

This option is also visible in an existing merge request next to the merge request button and can be selected or deselected before merging. It is only visible to users with the Maintainer role in the source project.

If the user viewing the merge request does not have the correct permissions to delete the source branch and the source branch is set for deletion, the merge request widget displays the Deletes source branch text.

Delete source branch status

Branch retargeting on merge (FREE SELF)

  • Introduced in GitLab 13.9.
  • Deployed behind a feature flag, disabled by default.
  • Enabled by default in GitLab 13.10.
  • Recommended for production use.
  • To use in GitLab self-managed instances, ask a GitLab administrator to disable it. (FREE SELF)

In specific circumstances, GitLab can retarget the destination branch of open merge request, if the destination branch merges while the merge request is open. Merge requests are often chained in this manner, with one merge request depending on another:

  • Merge request 1: merge feature-alpha into main .
  • Merge request 2: merge feature-beta into feature-alpha .

These merge requests are usually handled in one of these ways:

  • Merge request 1 is merged into main first. Merge request 2 is then retargeted to main .
  • Merge request 2 is merged into feature-alpha . The updated merge request 1, which now contains the contents of feature-alpha and feature-beta , is merged into main .

GitLab retargets up to four merge requests when their target branch is merged into main , so you don’t need to perform this operation manually. Merge requests from forks are not retargeted.

The feature today works only on merge. Clicking the Remove source branch button after the merge request was merged will not automatically retarget a merge request. This improvement is tracked as a follow-up.

Recommendations and best practices for merge requests

  • When working locally in your branch, add multiple commits and only push when you’re done, so GitLab runs only one pipeline for all the commits pushed at once. By doing so, you save pipeline minutes.
  • Delete feature branches on merge or after merging them to keep your repository clean.
  • Take one thing at a time and ship the smallest changes possible. By doing so, reviews are faster and your changes are less prone to errors.
  • Do not use capital letters nor special chars in branch names.

Enable or disable branch retargeting on merge (FREE SELF)

Automatically retargeting merge requests is under development but ready for production use. It is deployed behind a feature flag that is enabled by default. GitLab administrators with access to the GitLab Rails console can opt to disable it.

gitlab merge request. Who is the assignee?

There is one particular point I don’t understand for GitLab’s merge requests.

I cloned a repository and made a feature branch. I worked something on it, committed it, and pushed the new branch to my GitLab repo.

With that I can make a merge request. When I do it says:

Assignee (and Assign to me)

Who should I assign it to? I mean, if I assign it to me, it is going to be me who "reviews" the change and approves it, so what is the point?

Or should I assign it to the repository administrator? Or to other member reviewers, so that they can check that and approve the merge?

What is the "Assign to me" option, and how does that makes sense?

karel's user avatar

2 Answers 2

There is documentation for that. It states:

This person owns the merge request, but isn’t responsible for reviewing it.

Additionally, the documentation explains an exemplary merge request workflow. You would typically create the MR before working on your feature branch. Then you can use the Assign to me feature to indicate that you are the one currently working on implementing the features of the MR. After your work is done you can request approval from a reviewer by assigning the MR to them (see Step 7 in the MR flow).

The people who are assigned to a merge request are the people who are responsible for it, not in a review kind of sense.
Usually it is the person who creates the pull request who counts as responsible for it i.e. has the responsibility of merging when all reviewers are happy and have approved or making changes according to the reviewers comments.

However, multiple people can have this responsibility as it is not always prudent for this to rest on a single person (what if the person goes on vacation?). Another case is if multiple developers have been working on the same feature and therefor have shared responsibility for the code in the merge request.

TL;DR Multiple people can have responsibility / can be accountable for the merge request.

    The Overflow Blog
Related
Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.3.3.43278

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Name already in use

gitlabhq / doc / user / project / merge_requests / index.md

  • Go to file T
  • Go to line L
  • Copy path
  • Copy permalink
  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents

Copy raw contents

Copy raw contents

Merge requests (FREE)

To incorporate changes from a source branch to a target branch, you use a merge request (MR).

When you open a merge request, you can visualize and collaborate on the changes before merge. Merge requests include:

  • A description of the request.
  • Code changes and inline code reviews.
  • Information about CI/CD pipelines.
  • A comment section for discussion threads.
  • The list of commits.

For a quick overview of merge requests, view this GitLab Flow video.

Create a merge request

Learn the various ways to create a merge request.

View merge requests

You can view merge requests for your project, group, or yourself.

View merge requests for a project

To view all merge requests for a project:

  1. On the top bar, select Main menu > Projects and find your project.
  2. On the left sidebar, select Merge requests.

Or, to use a keyboard shortcut, press g + m .

View merge requests for all projects in a group

To view merge requests for all projects in a group:

  1. On the top bar, select Main menu > Groups and find your group.
  2. On the left sidebar, select Merge requests.

If your group contains subgroups, this view also displays merge requests from the subgroup projects.

View all merge requests assigned to you

To view all merge requests assigned to you:

  1. On the top bar, put your cursor in the Search box.
  2. From the dropdown list, select Merge requests assigned to me.
  • To use a keyboard shortcut, press Shift + m .
  1. On the top bar, in the upper-right corner, select Merge requests ( ).
  2. From the dropdown list, select Assigned to you.

Filter the list of merge requests

  • Filtering by approved-by introduced in GitLab 13.0.
  • Filtering by reviewer introduced in GitLab 13.7.
  • Filtering by potential approvers was moved to GitLab Premium in 13.9.
  • Filtering by approved-by moved to GitLab Premium in 13.9.

To filter the list of merge requests:

  1. Above the list of merge requests, select Search or filter results. .
  2. From the dropdown list, select the attribute you wish to filter by. Some examples:
      .
    • ID: Enter filter #30 to return only merge request 30.
    • User filters: Type (or select from the dropdown list) any of these filters to display a list of users:
      • Approved-By, for merge requests already approved by a user. (PREMIUM).
      • Approver, for merge requests that this user is eligible to approve. (For more information, read about Code owners). (PREMIUM)
      • Reviewer, for merge requests reviewed by this user.
  3. Select or type the operator to use for filtering the attribute. The following operators are available:
    • = : Is
    • != : Is not
  4. Enter the text to filter the attribute by. You can filter some attributes by None or Any.
  5. Repeat this process to filter by multiple attributes. Multiple attributes are joined by a logical AND .
  6. Select a Sort direction, either for descending order, or for ascending order.

GitLab displays the results on-screen, but you can also retrieve them as an RSS feed.

Filter merge requests by environment or deployment date

To filter merge requests by deployment data, such as the environment or a date, you can type (or select from the dropdown list) the following:

  • Environment
  • Deployed-before
  • Deployed-after

NOTE: Projects using a fast-forward merge method do not return results, as this method does not create a merge commit.

When filtering by an environment, a dropdown list presents all environments that you can choose from:

Filter MRs by their environment

When filtering by Deployed-before or Deployed-after , the date refers to when the deployment to an environment (triggered by the merge commit) completed successfully. You must enter the deploy date manually. Deploy dates use the format YYYY-MM-DD , and must be quoted if you wish to specify both a date and time ( «YYYY-MM-DD HH:MM» ):

Filter MRs by a deploy date

Add changes to a merge request

If you have permission to add changes to a merge request, you can add your changes to an existing merge request in several ways, depending on the complexity of your change and whether you need access to a development environment:

    in your browser with the . keyboard shortcut. Use this browser-based method to edit multiple files, or if you are not comfortable with Git commands. You cannot run tests from the Web IDE. , if you need a fully-featured environment to both edit files, and run tests afterward. Gitpod supports running the GitLab Development Kit (GDK). To use Gitpod, you must enable Gitpod in your user account. , if you are familiar with Git and the command line.

Assign a user to a merge request

To assign the merge request to a user, use the /assign @user quick action in a text area in a merge request, or:

  1. On the top bar, select Main menu > Projects and find your project.
  2. On the left sidebar, select Merge requests and find your merge request.
  3. On the right sidebar, expand the right sidebar and locate the Assignees section.
  4. Select Edit.
  5. Search for the user you want to assign, and select the user.

The merge request is added to the user’s assigned merge request list.

Assign multiple users (PREMIUM)

Moved to GitLab Premium in 13.9.

GitLab enables multiple assignees for merge requests, if multiple people are accountable for it:

multiple assignees for merge requests sidebar

To assign multiple assignees to a merge request, use the /assign @user quick action in a text area, or:

  1. On the top bar, select Main menu > Projects and find your project.
  2. On the left sidebar, select Merge requests and find your merge request.
  3. On the right sidebar, expand the right sidebar and locate the Assignees section.
  4. Select Edit and, from the dropdown list, select all users you want to assign the merge request to.

To remove an assignee, clear the user from the same dropdown list.

Close a merge request

If you decide to permanently stop work on a merge request, GitLab recommends you close the merge request rather than delete it. The author and assignees of a merge request, and users with Developer, Maintainer, or Owner roles in a project can close merge requests in the project:

  1. Go to the merge request you want to close.
  2. Scroll to the comment box at the bottom of the page.
  3. Following the comment box, select Close merge request.

GitLab closes the merge request, but preserves records of the merge request, its comments, and any associated pipelines.

Delete a merge request

GitLab recommends you close, rather than delete, merge requests.

WARNING: You cannot undo the deletion of a merge request.

To delete a merge request:

  1. Sign in to GitLab as a user with the project Owner role. Only users with this role can delete merge requests in a project.
  2. Go to the merge request you want to delete, and select Edit.
  3. Scroll to the bottom of the page, and select Delete merge request.

Delete the source branch on merge

You can delete the source branch for a merge request:

  • When you create a merge request, by selecting Delete source branch when merge request accepted.
  • When you merge a merge request, if you have the Maintainer role, by selecting Delete source branch.

An administrator can make this option the default in the project’s settings.

Update merge requests when target branch merges (FREE SELF)

    in GitLab 13.9. in GitLab 13.9. GitLab 13.10.

Merge requests are often chained together, with one merge request depending on the code added or changed in another merge request. To support keeping individual merge requests small, GitLab can update up to four open merge requests when their target branch merges into main . For example:

  • Merge request 1: merge feature-alpha into main .
  • Merge request 2: merge feature-beta into feature-alpha .

If these merge requests are open at the same time, and merge request 1 ( feature-alpha ) merges into main , GitLab updates the destination of merge request 2 from feature-alpha to main .

Merge requests with interconnected content updates are usually handled in one of these ways:

  • Merge request 1 is merged into main first. Merge request 2 is then retargeted to main .
  • Merge request 2 is merged into feature-alpha . The updated merge request 1, which now contains the contents of feature-alpha and feature-beta , is merged into main .

This feature works only when a merge request is merged. Selecting Remove source branch after merging does not retarget open merge requests. This improvement is proposed as a follow-up.

Move sidebar actions

Introduced in GitLab 14.10 with a flag named moved_mr_sidebar . Disabled by default.

FLAG: On self-managed GitLab, by default this feature is not available. To make it available per project or for your entire instance, ask an administrator to enable the feature flag named moved_mr_sidebar . On GitLab.com, this feature is enabled in the following projects: gitlab-org/gitlab , gitlab-com/www-gitlab-com , and gitlab-org/customers-gitlab-com .

When this feature flag is enabled, in the upper-right corner, Merge request actions ( ) contains the following actions:

  • The notifications toggle
  • Mark merge request as ready or draft
  • Close merge request
  • Copy reference

When this feature flag is disabled, these actions are in the right sidebar.

Merge request workflows

For a software developer working in a team:

  1. You check out a new branch, and submit your changes through a merge request.
  2. You gather feedback from your team.
  3. You work on the implementation optimizing code with Code Quality reports.
  4. You verify your changes with Unit test reports in GitLab CI/CD.
  5. You avoid using dependencies whose license is not compatible with your project with License Compliance reports.
  6. You request the approval from your manager.
  7. Your manager:
    1. Pushes a commit with their final review. .
    2. Sets it to merge when pipeline succeeds.

    For a web developer writing a webpage for your company’s website:

    1. You check out a new branch and submit a new page through a merge request.
    2. You gather feedback from your reviewers.
    3. You preview your changes with Review Apps.
    4. You request your web designers for their implementation.
    5. You request the approval from your manager.
    6. Once approved, your merge request is squashed and merged, and deployed to staging with GitLab Pages.
    7. Your production team cherry-picks the merge commit into production.

    Rebase a merge request from the Rails console (FREE SELF)

    In addition to the /rebase quick action, users with access to the Rails console can rebase a merge request from the Rails console. Replace <username> , <namespace/project> , and <iid> with appropriate values:

    WARNING: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.

    Fix incorrect merge request status (FREE SELF)

    If a merge request remains Open after its changes are merged, users with access to the Rails console can correct the merge request’s status. Replace <username> , <namespace/project> , and <iid> with appropriate values:

    WARNING: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.

    Running this command against a merge request with unmerged changes causes the merge request to display an incorrect message: merged into <branch-name> .

    Close a merge request from the Rails console (FREE SELF)

    If closing a merge request doesn’t work through the UI or API, you may want to attempt to close it in a Rails console session:

    WARNING: Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore.

    Delete a merge request from the Rails console (FREE SELF)

    If deleting a merge request doesn’t work through the UI or API, you may want to attempt to delete it in a Rails console session:

    WARNING: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *