When you create a merge request, you select two branches to compare. The differences between the two branches are shown as a diff in the merge request. Each time you push commits to a branch connected to a merge request, GitLab updates the merge request diff to a new diff version.
By default, GitLab compares the latest push in your source branch (
against the most recent commit in the target branch, often
If you’ve pushed to your branch multiple times, the diff version from each previous push is available for comparison. When your merge request contains many changes or sequential changes to the same file, you might want to compare a smaller number of changes.
- The merge request branch must contain commits from multiple pushes. Individual commits in the same push do not generate new diff versions.
To compare diff versions:
- On the left sidebar, select Search or go to and find your project.
- Select Code > Merge requests.
- Select a merge request.
- To view the current diff version for this merge request, select Changes.
Next to Compare (), select the pushes to compare. This example compares
mainto the most recent push (latest diff version) of the branch:
This example branch has four commits, but the branch contains only three diff versions because two commits were pushed at the same time.
GitLab adds a system note to a merge request each time you push new changes to the merge request’s branch. In this example, a single push added two commits:
To view the diff for that commit, select the commit SHA.
For more information, see how to show or filter system notes on a merge request.