Merge request commits
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.
Navigate merge request commits
Introduced in GitLab 13.0.
To navigate commits in a merge request:
- Select the Commits tab.
- Select the commit link. The most recent commit is displayed.
-
Navigate through the commits by either:
- Selecting Prev and Next buttons below the tab buttons.
- Using the X and C keyboard shortcuts.
View merge request commits in context
-
Introduced in GitLab 13.12 with a flag named
context_commits
. Enabled by default. - Enabled on GitLab.com in GitLab 14.8.
-
Generally available in GitLab 14.9. Feature flag
context_commits
removed.
When reviewing a merge request, it helps to have more context about the changes made. That includes unchanged lines in unchanged files, and previous commits that have already merged that the change is built on.
To add previously merged commits to a merge request for more context:
- Go to your merge request.
- Select the Commits tab.
- Scroll to the end of the list of commits, and select Add previously merged commits:
- Select the commits that you want to add.
- Select Save changes.
View diffs between commits
To view the changes between previously merged commits:
If you selected to add previously merged commits, they are displayed in the list.