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
main...feature/loginNot inspected
- app.js+24-0
- style.css+8-0
Run the comparison
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/loginExample 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/loginThree 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.htmlgit log --oneline main..feature/loginReview the feature commits. It lists commits present on the feature branch but not on main.
Example Output
7f3a91c Validate login form
4d2bc08 Add login formKnowledge 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
- Question 1: current
- Question 2: not started
- Question 3: not started
- Question 4: not started
- Question 5: not started