FresherTechnicalGit
What is a pull request and what is it for?
Try answering first
Model answer
A pull request (PR, called a merge request on GitLab) is a request to merge the commits of one branch into another, usually into main. It is a feature of hosting platforms such as GitHub, not of Git itself.
A PR gives the team one place to:
- See the diff of all changes in the branch.
- Discuss the code with line comments and review it, with approve or request-changes decisions.
- Run automated checks such as tests, linters and builds.
- Merge once the rules are met, and keep a record of why the change was made.
Typical flow:
git switch -c feature/login-validation
git commit -am "Validate email on login"
git push -u origin feature/login-validation
# open the PR on the platform, address review comments, merge
If you push more commits to the same branch, the PR updates automatically.
Keep PRs small and focused with a clear description of what changed and how to test it, so reviewers can respond quickly. A PR is a conversation about code, not only a merge button.
Key points
- A PR asks to merge one branch into another
- It is a hosting platform feature, not core Git
- Provides diff, review discussion and automated checks
- Pushing to the branch updates the PR
Likely follow-ups
- What makes a PR easy to review?
- What is the difference between a PR and a merge request?
Common mistakes
- Opening huge PRs that mix unrelated changes
- Thinking pull requests are a built-in Git command