DEV Community

Booranasak Kanthong
Booranasak Kanthong

Posted on

Git | EP04: Getting Started with Git – Your Third Step: Merging a Pull Request

Welcome back to our beginner-friendly Git series! 👋
In EP03, we cloned a project, created a feature branch, wrote a Python script, and pushed our changes to GitHub.

Now it’s time to learn how to open a Pull Request (PR) and merge it into the main codebase — using GitHub’s interface.

A Pull Request is how you propose changes, review code, and collaborate before merging it into shared branches like develop or main.

What Is a Pull Request?

A Pull Request (PR) is like saying:

“Hey, I’ve made some changes — can we review and add them to the main project?”

It’s a common workflow used in open source and team projects to:

  • Collaborate safely
  • Review changes before merging
  • Trigger CI/CD pipelines or tests (in advanced setups)

Step-by-Step: Creating & Merging a Pull Request

1. Push a Feature Branch to GitHub

If you’ve followed along from EP03, you should already have done this:

git push -u origin feature/add-greeting-script
Enter fullscreen mode Exit fullscreen mode

Your code is now in a branch on GitHub, ready to review.

2. Go to Your GitHub Repository

Visit your repo’s page on GitHub.
You’ll usually see a banner like this:

This banner appears above the branch and code section, making it easy to start the pull request process.

Compare & pull request
"feature/add-greeting-script" had recent pushes less than a minute ago.

If You Don’t See the Banner

In that case, you can manually go to the Pull Requests tab

And click “New pull request”

Whether you come from banner or tab you will lead to this page


Select Branches to Create a Pull Request

On the GitHub "Compare changes" page, you'll need to choose the branches involved in your pull request:

  • Set the base branch (the target) — in our case: develop
  • Set the compare branch (the source) — in our case: feature/add-greeting-script This is the branch where your changes were made.
  • You can use the dropdown menus to switch between available branches.

Our Example
In this tutorial, we’re creating a pull request from feature/add-greeting-script to develop.

Reviewing the Changes
GitHub will compare both branches and display the differences:

  • Added, modified, or deleted files
  • Line-by-line code changes (highlighted in green(add) and red(remove))

If everything looks correct and you're confident in the changes, click the green "Create pull request" button.

This will open a form where you can add a title and description for your pull request before submitting it.

3. Fill Out the Pull Request Form

Now you’re on the PR creation page.
Here’s what to do:

  • Title: GitHub auto-fills it from your last commit (which is why Conventional Commits help!) Example:
feat(main): add greeting script in main.py
Enter fullscreen mode Exit fullscreen mode
  • Description: Write what this PR does, e.g.
This pull request adds a basic Python script (main.py) that greets the user.
This is part of the Git learning series EP04.
Enter fullscreen mode Exit fullscreen mode

Add Reviewers and Assignees

  • Reviewers: People expected to review the code. They can approve or request changes.
  • Assignees (optional): Person responsible for tracking or managing the PR (can be the same as the author).

Even if no assignee is selected, the PR can still be merged — as long as permissions and review rules allow it.

After everything click green button "Merge Pull Request"

It will ask you to confirm, you can simply select "Confirm merge" green button

And You’re Done!

You can also delete this branch because we’ve already merged it.

After delete this is the result

6. Pull the Latest Code Locally

To update your local repo with the merged changes:

git checkout develop
Enter fullscreen mode Exit fullscreen mode

Apply git pull

git pull
Enter fullscreen mode Exit fullscreen mode

Your develop branch is now fully up to date with the remote version.

Summary Diagram: PR Workflow

[ Coder (Author) ]
        │
        ▼
[ Push branch to GitHub ]
        │
        ▼
[ Open Pull Request ]
        │
        ├── Set Title (auto-filled from commit)
        ├── Write Description
        ├── Add Reviewer(s)
        └── (Optionally) Assign responsible person
        │
        ▼
[ Reviewer(s) Review the Code ]
        │
   ┌────┴────┐
   │         │
[ Approve ]  [ Request Changes ]
   │
   ▼
[ Merge Pull Request ]

Enter fullscreen mode Exit fullscreen mode

Top comments (0)