Merge requests

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Query fields

FieldName (and alias)Operators
Approved by userapprover, approvedBy, approvers=, !=
Assigneesassignee, assignees=, !=
Authorauthor=, !=
Closed atclosed, closedAt=, >, <, >=, <=
Created atcreated, createdAt, opened, openedAt=, >, <, >=, <=
Draftdraft=, !=
Environmentenvironment=
Groupgroup=
IDid=, in
Include subgroupsincludeSubgroups=, !=
Labelslabel, labels=, !=
Merged atmerged, mergedAt=, >, <, >=, <=
Merged by usermerger, mergedBy=
Milestonemilestone=, !=
My reaction emojimyReaction, myReactionEmoji=, !=
Projectproject=
Reviewersreviewer, reviewers, reviewedBy=, !=
Source branchsourceBranch=, in, !=
Statestate=
Subscribedsubscribed=, !=
Target branchtargetBranch=, in, !=
Deployed atdeployed, deployedAt=, >, <, >=, <=
Updated atupdated, updatedAt=, >, <, >=, <=

Approved by user

Description: Query merge requests by one or more users who approved the merge request.

Allowed value types:

  • String
  • User (for example, @username)
  • List (containing String or User values)
  • Nullable (either of null, none, or any)

Assignees

Description: Query merge requests by one or more users who are assigned to them.

Allowed value types:

  • String
  • User (for example, @username)
  • Nullable (either of null, none, or any)

Notes:

  • List values and the in operator are not supported for merge requests.

Author

Description: Query merge requests by their author.

Allowed value types:

  • String
  • User (for example, @username)

Notes:

  • The in operator is not supported for merge requests.

Closed at

Description: Query merge requests by the date when they were closed.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

Notes:

  • For the = operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
  • >= and <= operators are inclusive of the dates being queried, whereas > and < are not.

Created at

Description: Query merge requests by the date when they were created.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

Notes:

  • For the = operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
  • >= and <= operators are inclusive of the dates being queried, whereas > and < are not.

Draft

Description: Query merge requests by their draft status.

Allowed value types:

  • Boolean (either of true or false)

Deployed at

Description: Query merge requests by the date when they were deployed.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

Notes:

  • For the = operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
  • >= and <= operators are inclusive of the dates being queried, whereas > and < are not.

Environment

Description: Query merge requests by the environment to which they have been deployed.

Allowed value types: String

Group

Description: Query merge requests in all projects in a given group.

Allowed value types: String

Notes:

  • Only one group can be queried at a time.
  • The group cannot be used together with the project field.
  • Using the group field queries all merge requests in that group, all its subgroups, and child projects.
  • By default, merge requests are searched in all descendant projects across all subgroups. To query only the direct child projects of the group, set the includeSubgroups field to false.

ID

Description: Query merge requests by their IDs.

Allowed value types:

  • Number (only positive integers)
  • List (containing Number values)

Include subgroups

Description: Query merge requests in the entire hierarchy of a group.

Allowed value types:

  • Boolean (either of true or false)

Notes:

  • This field can only be used with the group field.
  • The value of this field defaults to false.

Labels

Description: Query merge requests by their associated labels.

Allowed value types:

  • String
  • Label (for example, ~bug, ~"team::planning")
  • Nullable (either of none, or any)

Notes:

  • The in operator is not supported for merge requests.
  • Scoped labels, or labels containing spaces must be wrapped in quotes.

Merged at

Description: Query merge requests by the date when they were merged.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

Notes:

  • For the = operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
  • >= and <= operators are inclusive of the dates being queried, whereas > and < are not.

Merged by user

Description: Query merge requests by the user that merged the merge request.

Allowed value types:

  • String
  • User (for example, @username)

Milestone

Description: Query merge requests by their associated milestone.

Allowed value types:

  • String
  • Milestone (for example, %Backlog, %"Awaiting Further Demand")
  • Nullable (either of none, or any)

Notes:

  • The in operator is not supported for merge requests.
  • Milestones containing spaces must be wrapped in quotes (").

My reaction emoji

Description: Query merge requests by the current user’s emoji reaction on it.

Allowed value types: String

Project

Description: Query merge requests in a particular project.

Allowed value types: String

Notes:

  • Only one project can be queried at a time.
  • The project field cannot be used together with the group field.
  • If omitted when using inside an embedded view, project is assumed to be the current project.

Reviewers

Description: Query merge requests that were reviewed by one or more users.

Allowed value types:

  • String
  • User (for example, @username)
  • Nullable (either of null, none, or any)

Source branch

Description: Query merge requests by their source branch.

Allowed value types: String, List

Notes:

  • List values are only supported with the in and != operators.

State

Description: Query merge requests by state.

Allowed value types:

  • Enum, one of opened, closed, merged, or all

Notes:

  • The state field does not support the != operator.

Subscribed

Description: Query merge requests by whether the current user has set notifications on or off.

Allowed value types: Boolean

Target branch

Description: Query merge requests by their target branch.

Allowed value types: String, List

Notes:

  • List values are only supported with the in and != operators.

Updated at

Description: Query merge requests by when they were last updated.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

Notes:

  • For the = operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
  • >= and <= operators are inclusive of the dates being queried, whereas > and < are not.

Display fields

FieldName or aliasDescription
Approved by userapprover, approvers, approvedByDisplay users who approved the merge request
Assigneesassignee, assigneesDisplay users assigned to the merge request
AuthorauthorDisplay the author of the merge request
Closed atclosed, closedAtDisplay time since the merge request was closed
Created atcreated, createdAtDisplay time since the merge request was created
Deployed atdeployed, deployedAtDisplay time since the merge request was deployed
DescriptiondescriptionDisplay the description of the merge request
DraftdraftDisplay Yes or No indicating whether the merge request is in draft state
IDidDisplay the ID of the merge request
Labelslabel, labelsDisplay labels associated with the merge request
Last commentlastCommentDisplay the last comment made on the merge request
Merged atmerged, mergedAtDisplay time since the merge request was merged
MilestonemilestoneDisplay the milestone associated with the merge request
Reviewersreviewer, reviewersDisplay users assigned to review the merge request
Source branchsourceBranchDisplay the source branch of the merge request
Source projectsourceProjectDisplay the source project of the merge request
StatestateDisplay a badge indicating the state. Values are Open, Closed, or Merged
SubscribedsubscribedDisplay Yes or No indicating whether the current user is subscribed
Target branchtargetBranchDisplay the target branch of the merge request
Target projecttargetProjectDisplay the target project of the merge request
TitletitleDisplay the title of the merge request
Updated atupdated, updatedAtDisplay time since the merge request was last updated

Sort fields

FieldName (and alias)Description
Closed atclosed, closedAtSort by closed date
Createdcreated, createdAtSort by created date
Merged atmerged, mergedAtSort by merge date
MilestonemilestoneSort by milestone due date
PopularitypopularitySort by the number of thumbs up emoji reactions
TitletitleSort by title
Updated atupdated, updatedAtSort by last updated date

Examples:

  • List all merge requests in the gitlab-org group created by me sorted by the merge date (latest first):

    ```glql
    display: table
    fields: title, reviewer, merged
    sort: merged desc
    query: group = "gitlab-org" and type = MergeRequest and state = merged and author = currentUser()
    limit: 10
    ```