๐Ÿ“ Git & GitHub

Pull Requests: the complete guide ๐Ÿ”€

P
Author
PyLand Team
๐Ÿ“…
Published
06.05.2026
โฑ๏ธ
Reading time
4 min
๐Ÿ‘๏ธ
Views
391
๐ŸŒณ
Level
Advanced

A Pull Request (PR) is a formal proposal to merge changes from one branch into another. It is the cornerstone tool of collaborative development.

What is a Pull Request in plain English

Imagine: you’ve been working on a new feature in a separate branch and you’re done. Now you want those changes to land in the main branch (main). Merging it in directly isn’t great practice โ€” no one has reviewed your work.

A Pull Request is:
1. Showing the team what you built
2. Asking for a review before merging
3. Getting feedback and discussing design decisions
4. Leaving a permanent record of decisions made

Your branch:  feature/login โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ—
                                        โ†“ Pull Request
Main:         main โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ—  โ† merge

PR vs committing directly to main

Committing directly to main Via Pull Request
Review Nobody checked it Team reviewed it
Bugs Land in main Caught before merge
History Unclear why Description and discussion
Rollback Harder Easier (revert PR)

In most professional teams, committing directly to main is forbidden.

How to create a Pull Request

Step 1: Push your branch

git push origin feature/my-feature

In GitHub Desktop: click Push origin (or Publish branch on the first push).

Step 2: Open GitHub

After pushing, GitHub will show a yellow banner:

“feature/my-feature had recent pushes โ€” Compare & pull request

Click it, or go to Pull requests โ†’ New pull request.

Step 3: Select branches

Make sure the direction is correct:

base: main  โ†  compare: feature/my-feature
  โ†‘ destination              โ†‘ source

Step 4: Fill in the PR details

  • Title โ€” short and specific
  • Description โ€” detailed (see the template below)

Step 5: Create the PR

Click Create pull request.

How to write a good PR description

Bad description โŒ

fix bug
update

Good description โœ…

## What was done
Added validation for the `description` field when creating a task.
The API now returns a proper response instead of a 500 error.

## Why
Bug from ticket #47: a task without a description was crashing the service.

## How to verify
1. Open POST /api/tasks
2. Send a request without the description field
3. Confirm the response is 200 with description: "No description"

## Notes
Using a default value for now. Later we can make description
nullable at the database level.

PR description template

## What was done
[1โ€“3 sentences describing the change]

## Why
[Context: the problem or task]

## How to verify
1. [Concrete step]
2. [Concrete step]

## Screenshots / Demo
[If there are visual changes]

Anatomy of a PR page

Conversation tab

The main discussion feed. Reviewer comments, event history (pushes, reviews, assignments).

Commits tab

All commits that will be included in the merge. Each commit links to its diff.

Files Changed tab โญ

The primary place for code review! A line-by-line diff of all changed files.
You can add inline comments to specific lines.

How to update a PR

After creating a PR, you don’t need to create a new one if something needs to change.

Just make a new commit in the same branch and push โ€” the PR updates automatically:

PR #12: feat: add login form

Commits:
โ— feat: create login form          โ† initial push
โ— fix: fix validation per review   โ† after review feedback
โ— docs: add comments as requested  โ† more revisions

PR statuses

Status Badge Meaning
Open ๐ŸŸข Open, awaiting review
Draft โšซ In progress, no review needed yet
Merged ๐ŸŸฃ Merged into the base branch
Closed ๐Ÿ”ด Closed without merging

Three merge strategies

Merge commit (default)

main: โ”€โ”€โ—โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ—โ”€โ”€ 
                                โ†‘
feature:    โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€/ (merge commit)

Full history โ€” all commits from the feature branch are visible. Recommended for learning.

Squash and merge

main: โ”€โ”€โ—โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ—โ”€โ”€ 
                                โ†‘
                          One commit containing everything

All commits from the feature branch are “squashed” into one. Clean history, but you lose granularity.

Rebase and merge

main: โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ—โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 
              โ†‘โ†‘โ†‘
        Feature commits "replanted" onto main

Linear history with no merge commit. For advanced users.

After merge: delete the branch

GitHub will immediately offer Delete branch. Accept it โ€” the branch has served its purpose.

To delete locally:

git branch -d feature/my-feature

In GitHub Desktop, switch to main, then go to Branch โ†’ Delete.

PRs for different scenarios

Typical PR within a team

You are a repo member โ†’ push a branch โ†’ open a PR โ†’ get a review โ†’ merge.

PR from a fork (Open Source)

You are not a member โ†’ fork โ†’ clone the fork โ†’ push to your fork โ†’ open a PR from the fork to the original.

See GitHub Fork: contributing to someone else’s project for details.

Useful PR features

Draft PR โ€” open a PR early, marked as “in progress.” Colleagues can see what you’re working on and give early feedback. When ready, click “Ready for review.”

Reviewers โ€” assign specific people to review. They’ll get a notification.

Assignees โ€” who is responsible for the PR (usually the author).

Labels โ€” tags: bug, feature, documentation, help wanted.

Linked Issues โ€” write Closes #42 in the description and the PR will automatically close the Issue on merge.

Why PRs matter for your career

Knowing how to write good PRs is one of the most important professional skills.

Employers look at:
- Your PR descriptions in open-source projects
- How you respond to review feedback
- The cleanliness of your commit history

A good PR shows that you think not just about the code, but about the team.

Your reaction to the article

๐Ÿ’ฌ Comments (0)

๐Ÿ” Sign in to leave a comment
๐Ÿšช Login
๐Ÿ’ญ

No comments yet

Be the first to share your opinion about this article!

๐Ÿ”— Similar

Similar articles

Continue learning with these materials

๐Ÿ“

Undo and Revert in GitHub Desktop: Fix Mistakes Wโ€ฆ

A commit is not a point of no return. GitHub Desktop lets you rebuild a...

๐Ÿ“… 16.07.2026 ๐Ÿ‘๏ธ 360
๐Ÿ“

History, Diffs, and Web Commits on GitHub

GitHub lets you read repository history, inspect individual commit diffs, view the history of one...

๐Ÿ“… 16.07.2026 ๐Ÿ‘๏ธ 312
๐Ÿ“

Your First Git Commit

Your first commit starts with initializing a repository, configuring the author identity, and selecting the...

๐Ÿ“… 30.06.2026 ๐Ÿ‘๏ธ 343
๐ŸŽ“ Continue learning

Courses that cover this material

Visit the course to apply this material in practice.

Git & GitHub Desktop: Teamwork Without the Pain Open course curriculum