Git & GitHub Course
Git & GitHub
/
Intermediate

Approvals & Merging

Definition

The final steps of a Pull Request workflow where reviewers formally accept the changes, and the code is subsequently integrated into the base branch.

Explain Like I'm New

Once you fix all the things your reviewers pointed out, they click a button that says 'Approve' (which adds a big green checkmark to your PR). Once you have enough approvals, the 'Merge' button unlocks, and you can squash your code into the main branch.

Real World Example

A company policy might require strictly 2 Approvals from Senior Developers before any code can be merged into the `production` branch.

Common Use Cases

  • •Finalizing the PR process

Terminal Output

bash / terminal
// No code needed. This is a GitHub UI process. // Step 1: Reviewer submits 'Approve' review. // Step 2: PR Author sees the green checkmark. // Step 3: PR Author clicks 'Squash and merge'. // Step 4: GitHub merges the code and asks: 'Delete branch?' // Step 5: ALWAYS click 'Delete branch' to keep the repository clean!

Interview Questions

basic

  • What are the three statuses a reviewer can submit?

intermediate

  • What is the difference between 'Create a merge commit' and 'Squash and merge'?

Flash Cards

Question

Three statuses?

Click to reveal answer
Answer

1. Comment (Just leaving thoughts), 2. Approve (Looks good, ready to merge), 3. Request Changes (Forces the PR to remain blocked until specific fixes are made).

Question

Merge commit vs Squash?

Click to reveal answer
Answer

'Merge commit' takes all 50 of your tiny commits and dumps them into the main history timeline, plus adds a 51st commit tying them together. 'Squash and merge' crushes your 50 commits into 1 single clean commit and places it on the main timeline.