Merge request commits

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

Each merge request has a history of the commits made to the source branch after the merge request was created.

These commits are displayed on the merge request’s Commits tab. From this tab, you can review commit messages and copy a commit’s SHA when you need to cherry-pick changes.

View commits in a merge request

To see the commits included in a merge request:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Merge requests, then select your merge request.
  3. To show a list of the commits in the merge request, newest first, select Commits . To read more about the commit, select Toggle commit description () on any commit.
  4. To view the changes in the commit, select the title of the commit link.
  5. To view other commits in the merge request, either:

    • Select Prev or Next.
    • Use keyboard shortcuts: X (previous commit) and C (next commit).

If your merge request builds upon a previous merge request, you might need to include more commits for context.

Show commits from previous merge requests

When you review a merge request, you might need information from previous commits to help understand the commits you’re reviewing. You might need more context if another merge request:

  • Changed files your current merge request doesn’t modify, so those files aren’t shown in your current merge request’s diff.
  • Changed files that you’re modifying in your current merge request, and you need to see the progression of work.

To add previously merged commits to a merge request for more context:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Merge requests, then select your merge request.
  3. Select Commits.
  4. Scroll to the end of the list of commits, and select Add previously merged commits.
  5. Select the commits that you want to add.
  6. Select Save changes.

Previously merged commits are referred to as Context Commits in the API.

Add a comment to a commit

caution
Threads created this way are lost if the commit ID changes after a force push.

To add discussion to a specific commit:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Commits.
  3. Below the commits, in the Comment field, enter a comment.
  4. Save your comment as either a standalone comment, or a thread:
    • To add a comment, select Comment.
    • To start a thread, select the down arrow (), then select Start thread.

View diffs between commits

To view the changes between previously merged commits:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Merge requests, then select your merge request.
  3. Select Changes.
  4. By Compare (), select the commits to compare:

    Previously merged commits

If you selected to add previously merged commits for context, those commits are also shown in the list.

Find the merge request that introduced a change

When you view the commit details page, GitLab links to one or more merge requests that contain that commit.

This behavior only applies to commits that are in the most recent version of a merge request. If the commits were in a merge request and were rebased out of that merge request, the commits are not linked.