Merge requests

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

Query fields

Field Name (and alias) Operators
Approved by user approver, approvedBy, approvers =, !=
Assignees assignee, assignees =, !=
Author author =, !=
Closed at closed, closedAt =, >, <, >=, <=
Created at created, createdAt, opened, openedAt =, >, <, >=, <=
Draft draft =, !=
Environment environment =
Group group =
ID id =, in
Include subgroups includeSubgroups =, !=
Labels label, labels =, !=
Merged at merged, mergedAt =, >, <, >=, <=
Merged by user merger, mergedBy =
Milestone milestone =, !=
My reaction emoji myReaction, myReactionEmoji =, !=
Project project =
Reviewers reviewer, reviewers, reviewedBy =, !=
Source branch sourceBranch =, in, !=
State state =
Subscribed subscribed =, !=
Target branch targetBranch =, in, !=
Deployed at deployed, deployedAt =, >, <, >=, <=
Updated at updated, 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

Field Name or alias Description
Approved by user approver, approvers, approvedBy Display users who approved the merge request
Assignees assignee, assignees Display users assigned to the merge request
Author author Display the author of the merge request
Closed at closed, closedAt Display time since the merge request was closed
Created at created, createdAt Display time since the merge request was created
Deployed at deployed, deployedAt Display time since the merge request was deployed
Description description Display the description of the merge request
Draft draft Display Yes or No indicating whether the merge request is in draft state
ID id Display the ID of the merge request
Labels label, labels Display labels associated with the merge request
Last comment lastComment Display the last comment made on the merge request
Merged at merged, mergedAt Display time since the merge request was merged
Milestone milestone Display the milestone associated with the merge request
Reviewers reviewer, reviewers Display users assigned to review the merge request
Source branch sourceBranch Display the source branch of the merge request
Source project sourceProject Display the source project of the merge request
State state Display a badge indicating the state. Values are Open, Closed, or Merged
Subscribed subscribed Display Yes or No indicating whether the current user is subscribed
Target branch targetBranch Display the target branch of the merge request
Target project targetProject Display the target project of the merge request
Title title Display the title of the merge request
Updated at updated, updatedAt Display time since the merge request was last updated

Sort fields

Field Name (and alias) Description
Closed at closed, closedAt Sort by closed date
Created created, createdAt Sort by created date
Merged at merged, mergedAt Sort by merge date
Milestone milestone Sort by milestone due date
Popularity popularity Sort by the number of thumbs up emoji reactions
Title title Sort by title
Updated at updated, updatedAt Sort 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
    ```