Back to roadmap

Lesson 13

Merge Requests

A merge request is a hosted proposal to review a pushed branch before a Git merge updates the target branch.

Visual Explanation

Ready to run git diff --stat main...feature/login.

Keep These Ideas

Proposal First
Teammates discuss, test, and approve the branch before it is merged.
Platform Feature
GitLab calls it a merge request; GitHub calls it a pull request. Git itself stores branches and commits.
Merge Comes Later
The target branch, usually main, changes only when the proposed work is actually merged.

The Real Command

Terminal
git diff --stat main...feature/login
Example Output
 app.js    | 24 ++++++++++++++++++++++++
 style.css |  8 ++++++++
 2 files changed, 32 insertions(+)

This local command summarizes what feature/login changed since it split from main. It helps prepare a review, but it does not open a merge request.

Command Details

git diff main...feature/login

Three dots compare from the shared base. It shows the feature's changes since the branches split.

Example Diff Excerpt
diff --git a/app.js b/app.js
+function validateLogin() {
+  return email.length > 0;
+}
git diff --name-status main...feature/login

--name-status lists file-level changes. M means modified and A means added.

Example Output
M app.js
A login.html
git log --oneline main..feature/login

Review the feature commits. It lists commits present on the feature branch but not on main.

Example Output
7f3a91c Validate login form
4d2bc08 Add login form

Knowledge Check

Review Before a Merge

Prepare a pushed branch for hosted review without confusing the proposal with Git's merge operation.

Question 1 of 5

  1. Question 1: current
  2. Question 2: not started
  3. Question 3: not started
  4. Question 4: not started
  5. Question 5: not started
Command Challenge

Show a compact file-and-line summary of work added on feature/login since it split from main.