Working together on GitHub · lesson 2 of 7
Commands and ideas in this lesson
APull requesta proposal to merge one branch into another
BReviewcomment, suggest, approve
CMerge, squash, rebasethe three merge buttons

Pull requests

Last updated

Carla typed up Lola Remy's kare-kare and wants it in Kusina. Instead of pushing to main, she pushed a branch and opened a pull request: a page on the host where the family can read the change, discuss it, and merge it when it's right. In this lesson you'll review and merge hers, then open your own.

By the end of this lesson you can

  • Explain pull requests as a hosting feature built on branches
  • Open a pull request from a pushed branch, with a description that helps a reviewer
  • Review a pull request: read the changes, comment, approve
  • Say what each of the three merge buttons does to the graph

A proposal, not a command

A pull request (GitLab says merge request) is a page on the hosting site that says: "please merge my branch into main". It isn't part of Git; it's built on Git's branches:

  1. Carla makes a branch, commits, and pushes the branch.
  2. On the host, she opens a pull request from her branch into main, with a title and a description.
  3. Others read the changes, comment, and approve or ask for changes. Carla pushes more commits to the same branch to answer; the pull request updates by itself.
  4. Someone presses Merge. The host merges the branch into main, on the host. Everyone pulls.

A good description says what changed, why, and anything a reviewer should check: "Typed up from page 14 of Lola's notebook. Lola says ground peanuts, not peanut butter."

Here is a real pull request on GitHub. Its author found mistakes in a tutorial, reported them in an issue, then fixed them:

Screenshot of pull request #129160, which fixes issue #129159, with numbered callouts. The numbered list below describes each part.
  1. Title and number. What the pull request does, and its number. Pull requests and issues share one sequence of numbers.
  2. State. Open until it’s merged or closed.
  3. From which branch, into which. “wants to merge 1 commit into firstcontributions:main from Thien0912:fix/…”: the branch, here on the author’s fork, and where it should go.
  4. Tabs. The conversation, the commits, automated checks, and Files changed: the diff (lesson 5.3).
  5. Description. What was wrong and what changed. “Fixes #129159” links the issue it solves, and will close it when merged (lesson 5.6).
  6. Reviewers and more. Who has been asked to review, and labels, projects and milestones.
  7. Development. The issue this pull request will close when it’s merged.
A pull request on GitHub. Screenshot of github.com, captured on 5 December 2026, signed out. GitHub changes its pages often, so yours may look a little different; the names in the list stay the same.

The Pull requests tab lists every open one, with filters for reviews, labels and authors:

Screenshot of the list of open pull requests on the same repository, with numbered callouts. The numbered list below describes each part.
  1. New pull request. Starts one by choosing two branches to compare.
  2. Open and Closed. How many are waiting, and how many were merged or closed. This project has taken over 124,000.
  3. Filters. Narrow the list by author, label, review state and more.
  4. One pull request. Its title, number, author and age, and whether its task list is done.
A repository’s list of pull requests on GitHub. Screenshot of github.com, captured on 5 December 2026, signed out. GitHub changes its pages often, so yours may look a little different; the names in the list stay the same.

Review and merge Carla’s

When reviewing, read every changed line, as the person who'll cook from it. Say what's good, ask about what's unclear, and suggest specific changes. Approve when you'd be happy for it to be in main.

Git sandbox
  1. Open “Files changed” on pull request #1 and read Carla’s recipe. Leave a review comment
  2. Approve it
  3. Merge it with any of the three buttons
  4. Pull, and find Carla’s recipe in your history

Working folder

no changes

Staging area

nothing staged

Repository

10 commits on main

Remote

origin: example.com/ana/kusina.git · in step, as of your last fetch

You are in ~/kusina. Carla has opened pull request #1 on the hosting site.

Commit graph

  1. 67e435d HEAD →mainorigin/main Cover the leche flan with foil
  2. ba04ca2 Add lumpiang shanghai recipe
  3. 98a5edc Add a script that builds the index page
  4. d078487 Make the sinigang steps clearer
  5. 145dc1e Add pancit bihon recipe
  6. 52d1f4d Say how much salt goes in the adobo
  7. 1c17fad Add a README
  8. 9c53888 Add leche flan recipe
  9. 1f359a2 Add sinigang recipe
  10. 601c654 Add adobo recipe

On the hosting site: example.com/ana/kusina

Branches: add-kare-kare, main

#1 Add kare-kare recipe Open

carla wants to merge add-kare-kare into main

Typed up from page 14 of Lola’s notebook. Lola says ground peanuts, not peanut butter.

Files changed
diff --git a/kare-kare.md b/kare-kare.md
new file mode 100644
index 0000000..2cf2018
--- /dev/null
+++ b/kare-kare.md
@@ -0,0 +1,10 @@
+# Kare-kare
+
+Oxtail in peanut sauce. Serves 6.
+
+## Ingredients
+
+- 1.5 kg oxtail
+- 1 cup ground roasted peanuts
+- 1 bunch pechay
+- bagoong to serve

Press Start over to try another button, and compare the graphs after pulling.

The three merge buttons

Hosts offer up to three ways to merge. Each leaves a different graph on main:

ButtonWhat it makes on mainCarla’s two commits
Merge pull requestA merge commit with two parents, "Merge pull request #1 from…"Kept, as they were, in a loop beside main
Squash and mergeOne new ordinary commit, "Add kare-kare recipe (#1)", with all the changesNot in main at all; only the squashed copy is
Rebase and mergeCopies of each commit, put after main's newest, no merge commitCopied, with new hashes, in a straight line

The repository's owner chooses which buttons are allowed. Teams that want a straight history allow squash or rebase; teams that want each pull request visible as a loop allow merge. Lesson 6.5 goes further.

Open your own

Git sandbox
  1. Make a branch add-turon and commit a turon recipe on it
  2. Push the branch, with an upstream
  3. Open a pull request from it on the hosting site, with a clear title

Working folder

no changes

Staging area

nothing staged

Repository

10 commits on main

Remote

origin: example.com/ana/kusina.git · in step, as of your last fetch

You are in ~/kusina. Carla has opened pull request #1 on the hosting site.

Commit graph

  1. 67e435d HEAD →mainorigin/main Cover the leche flan with foil
  2. ba04ca2 Add lumpiang shanghai recipe
  3. 98a5edc Add a script that builds the index page
  4. d078487 Make the sinigang steps clearer
  5. 145dc1e Add pancit bihon recipe
  6. 52d1f4d Say how much salt goes in the adobo
  7. 1c17fad Add a README
  8. 9c53888 Add leche flan recipe
  9. 1f359a2 Add sinigang recipe
  10. 601c654 Add adobo recipe

On the hosting site: example.com/ana/kusina

Branches: add-kare-kare, main

#1 Add kare-kare recipe Open

carla wants to merge add-kare-kare into main

Typed up from page 14 of Lola’s notebook. Lola says ground peanuts, not peanut butter.

Files changed
diff --git a/kare-kare.md b/kare-kare.md
new file mode 100644
index 0000000..2cf2018
--- /dev/null
+++ b/kare-kare.md
@@ -0,0 +1,10 @@
+# Kare-kare
+
+Oxtail in peanut sauce. Serves 6.
+
+## Ingredients
+
+- 1.5 kg oxtail
+- 1 cup ground roasted peanuts
+- 1 bunch pechay
+- bagoong to serve

On a real host, pushing a new branch prints a link to open a pull request, and the repository page shows a "Compare & pull request" button.

Spot the trap: carrying on after a squash

Spot the trapCarla

Carla’s pull request is squash-merged. She stays on her add-kare-kare branch, adds a serving note, and opens a second pull request from the same branch.

What happens if…

Check what you learned

Is a pull request part of Git?
Which merge button leaves the pull request’s commits out of main, replaced by one new commit?
A reviewer asks Carla to change a quantity. How does she update her pull request?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git