Merge requests in GitLab

Ivan Ivanov


1 Intro

1.1 Intro

  • Allow to exchange changes made to source code
  • Collaborate with other people on the same project
  • Request to merge one brach into another

2 Benefits of using GitLab Merge requests

2.1 Benefits of using GitLab Merge requests

  • Comparison between changes in two branches
  • Reviews and discussions – proposed modifications inline
  • Live preview of the changes when Review Apps configured for the project
  • Builds, tests and deployment in a per-branch basis with built-in GitLab CI/CD
  • Prevent the MR from being merged before it’s ready with Work In Progress MRs

2.2 Benefits of using GitLab Merge requests

  • Visible deployment process through Pipeline Graphs
  • Automatically closure of issues that originated the implementation proposed in the MR
  • Convenience by reassigning the assignee
  • Convenience by assigning a milestone and keeping track of the development
  • Easier organization of issues and MRs with labels

2.3 Benefits of using GitLab Merge requests

  • Time Estimation & Time Spent with Time Tracking
  • Resolve merge conflicts from the UI
  • Possible Fast-Forward MRs
  • Semi-Linear history MRs – another security layer for pipeline passing

2.4 Benefits of using GitLab Merge requests

  • Creation of new MRs by email
  • Possible edit of the MR from maintainers

3 Merge requests per project

3.1 Merge requests per project

  • Project > Merge Requests
  • Open/Merged/Closed Requests

An example of Project MRs

4 Merge requests per group

4.1 Merge requests per group

  • Group > Merge Requests

An example of Group MRs

5 Removing the source branch

5.1 Removing the source branch

  • “Remove source branch when merge request accepted” option on creation of a MR
  • Also visible in an existing one
  • Visible only to master users

An example of removing source branch

6 Discussions

6.1 Discussions

  • Comments at issues, MRs, snippets, commits, commit diffs
  • Resolvable discussions

An example of resolvable discussion

6.2 Discussions

  • Commit discussions in the context of a MR

6.3 Discussions

  • Jumping between unresolved discussions
  • Marking a comment or discussion as resolved
  • Move all unresolved discussions in a merge request to an issue
  • Moving a single discussion to a new issue

6.4 Discussions

  • Only allow merge requests to be merged if all discussions are resolved
  • Automatically resolve merge request diff discussions when they become outdated
  • Threaded discussions
  • Image discussions
  • Lock discussions

7 Automatically close an issue

7.1 Automatically close an issue

  • Via Merge Request

Closing an issue

  • From the Issue Board

8 Labels

8.1 Labels

  • Allow categorization of issues and MRs using discriptive titles
  • Project and group labels
  • Issues > Labels An example of labels

9 Fast-Forward Merge requests

9.1 Fast-Forward Merge requests

  • Linear Git history
  • No merge commits
  • Settings → ‘Merge method’ → Fast-forward merge

10 Semi-Linear history merge requests

10.1 Semi-Linear history merge requests

  • Merge commit for every merge
  • Merged only if FF possible
  • Ensures success by pipeline passing
  • Merge Requests: Merge method → Merge commit with semi-linear history

11 Creation of new merge requests by email

11.1 Creation of new merge requests by email

  • By clicking on “Email a new merge request to this project” button
  • The subject – the source branch name
  • The message body – the MR description An example of creation by email