DevOps practicesBeginner19 min read

What Is Pull request in DevOps?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

A pull request is a feature in tools like GitHub and GitLab that lets you tell others about changes you have pushed to a branch. It starts a discussion and review process before the changes are combined with the main code. Pull requests help teams catch bugs and maintain code quality before updates go live.

Commonly Confused With

Pull requestvsMerge

A merge is the action of combining changes from one branch into another, often performed within a pull request. A pull request is the entire review and discussion process that leads to a merge. Not every merge comes from a pull request; direct merges are possible but less safe.

You create a pull request to discuss a new feature. After approval, you click the merge button to combine the branches. The merge is just the final step.

Pull requestvsFork

A fork is a full copy of a repository under a different account, typically used to experiment freely without affecting the original project. A pull request can be used to suggest changes from a fork back to the original repository. Forks are common in open source, while pull requests in the same repository are common in team workflows.

If you do not have write access to a repository, you fork it, make changes, and then submit a pull request from your fork to the original repo.

Pull requestvsCommit

A commit is a single snapshot of changes to the code. A pull request typically contains one or more commits. The pull request is not a commit; it is a container for a set of commits along with discussion and review. You cannot review a single commit in the same way you review a pull request.

You make three commits on a branch, then open a pull request that includes all three. The pull request lets reviewers see the combined changes before merging.

Must Know for Exams

Pull requests appear in a wide range of IT certification exams, though they are most prominent in DevOps and development-focused certifications. For the AWS Certified DevOps Engineer - Professional exam, understanding how pull requests integrate with CI/CD pipelines is important. You might see questions about how to set up branch protection rules that require pull requests before merging to a main branch. Similarly, the Google Cloud DevOps Engineer exam covers pull requests in the context of Cloud Source Repositories and how they trigger Cloud Build.

The GitHub Foundations and GitHub Actions certifications are heavily centered around pull requests. Exam objectives include creating pull requests, requesting reviews, managing merge strategies, and using GitHub Actions to automate checks on pull requests. Questions can ask which status checks are required before a merge, or how to configure branch protection. The GitLab Certified Associate exam also tests pull request workflows, though they call them merge requests. You need to know the difference between merge request approval rules and how to set them up.

Even in broader exams like the CompTIA IT Fundamentals (ITF+), you might see basic questions about version control and collaboration, including the concept of proposing changes via pull requests. For the Certified Kubernetes Administrator (CKA), while not directly about pull requests, the exam expects you to understand declarative configuration management, which often relies on pull request workflows to update infrastructure as code.

In all these exams, the question types vary. Some are multiple-choice: "Which action triggers a code review process in Git?" Others are scenario-based: "A developer wants to suggest changes to a repository without altering the main branch directly. What should they do?" You may also encounter troubleshooting questions: "A merge conflict occurs when attempting to merge a pull request. What is the first step to resolve it?" Knowing the pull request lifecycle from creation to merge is key to scoring points on these exam objectives.

Simple Meaning

Imagine you are working on a group project writing a long story in a shared document. You have a copy of the story on your own computer, and you add a new chapter. Before you add your chapter to the shared document, you do not just paste it in right away. Instead, you send a note to your teammates saying, "I wrote a new chapter. Please look it over and tell me if it fits the story, or if there are any mistakes." That note is like a pull request. It is a polite request for your teammates to review your work and decide if they want to accept it into the official story.

In the world of software, a pull request works the same way. A developer makes changes in a separate copy of the code. When they are ready, they create a pull request to ask the rest of the team to review those changes. The team can see exactly what lines were added, changed, or removed. They can leave comments, ask questions, and suggest improvements. Once everyone is happy, someone with permission clicks a button to merge the changes into the main codebase. If there are problems, the pull request can be rejected or the developer can fix the issues and update the pull request.

This process keeps the main code stable and safe. It prevents one person from accidentally breaking everything. It also helps everyone learn from each other because they can see what changes are being made and discuss them. Pull requests are a fundamental part of modern teamwork in software development, especially for projects using version control systems like Git.

Full Technical Definition

A pull request is a mechanism in distributed version control systems, primarily Git, that facilitates code review and controlled integration of changes from one branch into another. When a developer completes work on a feature branch, they push the branch to a remote repository, such as on GitHub, GitLab, or Bitbucket. They then create a pull request through the platform's interface. This action signals to other team members that changes are ready for review.

The pull request displays a diff, which is a detailed comparison showing every line added, removed, or modified. It references the source branch (the one with the changes) and the target branch (usually main or master). The platforms also show commit history, file changes, and can run automated checks. Continuous integration and continuous deployment (CI/CD) pipelines are often triggered automatically when a pull request is opened. These pipelines run tests, linting, security scans, and build processes to verify the code does not break anything.

Reviewers are assigned to examine the code. They can leave inline comments on specific lines, ask for changes, or approve the pull request. Once all reviewers approve and all automated checks pass, the pull request can be merged. There are several merge strategies: merge commit (creates an extra commit), squash and merge (combines all commits into one), and rebase and merge (applies commits cleanly on top of the target branch). The choice depends on the team's workflow and history preferences.

In real IT implementations, pull requests enforce branch protection rules. For example, a repository can require at least one approval, passing status checks, and up-to-date branches before merging. Large organizations use pull requests to comply with auditing and regulatory requirements because they create a permanent record of who changed what and why. Platforms also support draft pull requests for work in progress, code owners for automatic reviewer assignment, and merge queues to manage integration order in busy repositories.

Real-Life Example

Think of a pull request like getting your homework checked by a teacher before turning it in. You write an essay for history class. You could hand it directly to the teacher, but you might have missed spelling mistakes or weak arguments. Instead, you ask a friend who is good at history to read it first. Your friend points out a few confusing sentences and suggests adding a better conclusion. You fix those things, and then your friend says, "Now it looks great." Then you submit it to the teacher.

In this analogy, your essay is the code you wrote. Your friend is the reviewer. The act of asking your friend to check it is the pull request. You are requesting that they "pull" your essay into their review. Once they approve, you finally submit it to the teacher, which is like merging into the main branch.

If you had just turned in the essay without review, you might have gotten a lower grade. Similarly, if a developer merges code without a pull request, bugs and messy code can get into the main software. The pull request prevents that by making sure someone else looks at the work first. It also teaches the first person how to write better code based on the feedback they get. In both cases, the review process improves the final result.

Why This Term Matters

Pull requests are essential in professional software development because they enforce quality and collaboration. Without pull requests, teams would have to trust every developer to commit correct code directly to the main branch. That approach is risky. A single mistake could break the application for all users and take hours to fix. Pull requests add a safety net by requiring at least one other person to review the changes.

They also create a clear history of changes. Each pull request contains a description, discussion, and links to related issues or tasks. This documentation helps future developers understand why a change was made. If a bug appears later, the team can look at the pull request that introduced it and see the reasoning behind the code.

In agile and DevOps workflows, pull requests are the gate between development and deployment. They integrate with task tracking systems like Jira to automatically update ticket statuses. They also trigger automated tests, so the reviewer knows the code has passed basic checks before they even look at it. This saves time and reduces human error. For certification exams, understanding pull requests shows you know how modern teams deliver software reliably. Many exam questions test your ability to describe the pull request workflow or troubleshoot issues like merge conflicts.

How It Appears in Exam Questions

Pull request questions often show up in scenario formats where you must decide the correct sequence of actions. For example, a question might describe a developer who has finished a new feature and now wants to propose those changes to the team. The answer choices might include creating a branch, committing changes, pushing the branch, and then opening a pull request. The correct order tests your understanding of the workflow.

Another common pattern involves branch protection rules. The question might say: "A repository owner wants to prevent direct commits to the main branch. Only approved pull requests should be merged. Which configuration is required?" You would have to select the option that enables branch protection with required pull request reviews.

Merge conflicts are a frequent topic. A question could state: "Two developers modified the same file in different pull requests. The first pull request is merged, causing the second pull request to show a conflict. What must the developer of the second pull request do?" The correct answer is to pull the latest changes from the main branch, resolve the conflict locally, and then push the fix.

Some questions test knowledge of pull request reviews. For instance: "A pull request has two required reviewers. Only one has approved. Can the pull request be merged?" The answer clarifies that merging is blocked until all required approvals are given.

You might also see questions about CI/CD integration: "Automated tests fail on a pull request. What happens to the merge option?" Typically, the merge button is disabled until tests pass. Questions like these assess your understanding of how pull requests enforce quality gates.

Finally, there are conceptual questions: "What is the primary purpose of a pull request?" Options might include code backup, code review, bug tracking, or deployment automation. The correct focus is code review and collaboration. Being familiar with these question patterns will help you answer confidently on exam day.

Study AZ-400

Test your understanding with exam-style practice questions.

Practise

Example Scenario

Imagine you are working in a team building a weather app. Your teammate Ana is adding a feature to show hourly forecasts. She creates a new branch called hourly-forecast from the main branch. She writes the code and commits it. Then she pushes the branch to the remote repository on GitHub.

Now Ana wants the rest of the team to check her work before it becomes part of the app. She goes to the GitHub page and clicks "New pull request." She selects her hourly-forecast branch as the source and main as the target. She writes a title: "Add hourly forecast view" and describes what she did. She asks for reviews from you and another teammate, Bob.

You get a notification. You look at the pull request and see a list of changed files. You notice that her code uses a hardcoded API key, which is a security risk. You leave an inline comment on that line saying, "Please move this to environment variables." Bob also looks and finds a typo in a variable name. He suggests a fix. Ana sees the comments, makes the changes in her local branch, and pushes new commits. The pull request automatically updates.

Once both you and Bob approve, and the automated tests pass, Ana clicks the "Merge pull request" button. The changes become part of the main branch. Later, the weather app gets deployed with the new hourly forecast. Because of the code review, the API key was protected, and the typo was fixed. This simple scenario mirrors real development: it shows how pull requests prevent errors and improve code quality through team collaboration.

Common Mistakes

Pushing changes directly to the main branch instead of creating a pull request.

This bypasses code review and automated checks, introducing errors directly into production.

Always create a separate branch, push it, and open a pull request. Use branch protection rules to enforce this.

Not keeping the pull request branch up to date with the main branch before merging.

This often causes merge conflicts and can result in integrating outdated code.

Regularly sync your branch with the latest changes from the main branch by rebasing or merging main into your feature branch.

Creating a pull request from a branch that is not fully committed or tested.

It wastes reviewers time and clogs the queue with incomplete work.

Run local tests and commit all changes before opening a pull request. Use draft pull requests for work in progress.

Confusing a pull request with a code deployment or release.

A pull request only proposes changes; merging does not automatically deploy to production.

Understand the difference: pull requests are for code review and merging. Deployment is a separate step often handled by CD pipelines after merge.

Ignoring comments on a pull request and merging anyway without addressing feedback.

This undermines the review process and can lead to unresolved issues in the code.

Address all review comments, even if you disagree. Discuss in the pull request and only merge after reaching consensus.

Exam Trap — Don't Get Fooled

{"trap":"A question asks: 'Which command creates a pull request?' and lists git pull-request as an option.","why_learners_choose_it":"Learners see the word 'pull' and think there is a Git command for it."

,"how_to_avoid_it":"Remember that creating a pull request is not a native Git command. You must use the platform's web interface or a CLI tool like gh (GitHub CLI) or hub. The correct native command does not exist in Git."

Step-by-Step Breakdown

1

Create a feature branch

Start by branching off the main branch. This isolates your changes so that you can work without affecting the stable code. Naming the branch something like 'feature/dark-mode' makes it clear what the branch is for.

2

Make commits

Write your code and commit changes with clear, descriptive messages. Each commit should represent a logical unit of work. This helps reviewers understand the progression of your changes.

3

Push the branch to the remote repository

Upload your branch to the shared hosting platform (GitHub, GitLab, etc.) so others can see it. Without this step, your local branch is invisible to the team.

4

Open a pull request

Navigate to the platform and create a new pull request. Select your feature branch as the source and the main branch as the target. Add a title and description, and optionally assign reviewers and link related issues. This starts the review process.

5

Review and discuss

Reviewers examine the code, leave comments, and ask for changes. You can respond, make additional commits, and push them to the same branch. The pull request updates automatically with each new commit.

6

Resolve merge conflicts

If the main branch has changed since you created your branch, there may be conflicts when merging. Pull the latest main branch, resolve conflicts locally, commit the fixes, and push again. The platform will recognize the resolution.

7

Merge the pull request

Once all reviewers approve and checks pass, you or a maintainer clicks the merge button. The changes become part of the target branch. The pull request is then closed and archived.

Practical Mini-Lesson

In practice, pull requests are the heartbeat of collaborative development. Professionals use them not just for code review, but also for documentation, configuration changes, and infrastructure as code. When working with Terraform, for example, a pull request can propose changes to infrastructure definitions, and the CI pipeline will run a plan to show what will be created or modified before merging.

One key skill is writing a good pull request description. It should include the problem or feature being addressed, a summary of the changes, any dependencies, and instructions for testing. This helps reviewers understand quickly. Many teams use templates that automatically populate these sections when a pull request is opened.

Another practical aspect is handling feedback. When a reviewer asks for changes, you should respond to each comment and either make the change or explain why you disagree. Using threads in the review makes this easier. Do not take feedback personally; it is about improving the code.

Automation is a huge part of modern pull requests. Tools like GitHub Actions can run linters, unit tests, security scans, and even deploy a preview environment for manual testing. The pull request status must be green before merging. If a check fails, the merge button is blocked. Professionals learn to monitor these checks and fix failures quickly. What can go wrong? Merge conflicts are the most common problem. They happen when two pull requests change the same part of a file. Resolving them requires pulling the latest main branch, editing the conflicted files to choose the correct version, and then pushing. Sometimes the CI fails due to test flakiness, requiring a restart. Other times, a reviewer may request significant changes that require rebasing the branch. Keeping branches short-lived (a few days max) reduces these problems.

Finally, professionals use pull requests to enforce compliance. For example, in financial services, a pull request might require two senior developers to approve and a security review to complete before merging. All pull request discussions are archived and can be audited later. Understanding these workflows is critical for any IT certification that covers software development practices.

Memory Tip

Think PR = Propose + Review: you propose changes, then the team reviews before merging.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Frequently Asked Questions

Do I need to use Git to create a pull request?

Yes, pull requests are a feature of Git hosting platforms. You must have your code in a Git repository on a platform like GitHub, GitLab, or Bitbucket.

Can I create a pull request from my own repository without collaborators?

You can create a pull request in your own repository, typically to merge your own feature branch into the main branch. It is still useful for running automated checks and keeping a clean history.

What happens if I delete the branch after the pull request is merged?

That is recommended practice. The changes are already in the main branch, so the feature branch is no longer needed. Deleting it keeps the repository clean.

Is a pull request the same as a merge request?

Essentially yes. GitLab uses the term merge request, while GitHub uses pull request. The concept is identical.

What is a draft pull request?

A draft pull request is one that is not ready for review yet. It shows work in progress. You can convert it to a regular pull request when you are ready.

Can I undo a merged pull request?

You can revert the merge by creating a new pull request that reverses the changes, or by using the revert button on the platform. This creates a new commit that undoes the merge.

Why do I get a merge conflict error when trying to merge a pull request?

Merge conflicts happen when the same part of a file has been changed in both the main branch and your feature branch. You need to resolve the conflict manually before the merge can proceed.

Summary

Pull requests are a fundamental DevOps practice that enables teams to propose, review, and merge code changes in a controlled manner. They serve as the primary mechanism for code review, which improves code quality and reduces bugs. By requiring a pull request before changes reach the main branch, teams enforce a safety net that includes automated testing, manual inspections, and discussion.

For IT certification candidates, understanding pull requests is essential for exams focused on version control, DevOps, and cloud platforms. You may encounter questions about the pull request workflow, branch protection rules, merge strategies, and troubleshooting merge conflicts. The ability to explain why pull requests matter in collaborative development is a common exam objective.

In real-world practice, pull requests are integrated with CI/CD pipelines, task tracking systems, and compliance tools. They create a permanent record of changes and decisions, which is valuable for auditing and knowledge transfer. The key takeaway for learners is that a pull request is not about the action of pulling code, but about requesting a review before merging. Mastering this concept will serve you well in both exams and professional development.