What is a Pull Request and what is it for?
Show answer — try answering out loud first
A Pull Request (PR) is a request to integrate the changes from one branch into another (for example, from feature into main), through a platform like GitHub. It's used to review the code before merging it: the team comments, suggests changes, runs automated tests, and approves. It's not a Git command, but a feature of GitHub/GitLab/Bitbucket.
Although you could technically merge your branch straight into main, on a team that's dangerous: no one reviewed your code. The PR is the mechanism for code review.
The typical flow:
- You create a branch, make your commits, and push it to the remote.
- You open a PR on GitHub proposing to merge your branch into
main. - Your teammates review: they comment on lines, request changes, approve.
- Automated tests (CI) run to verify that nothing breaks.
- Once it's approved, the PR is merged into
main.
The PR improves quality (another pair of eyes catches bugs), shares knowledge of the code, and leaves a record of why each change was made.
# The Git part: create the branch, commit, and push it
git switch -c agrega-validacion
git add .
git commit -m "Agrega validacion del formulario de login"
git push -u origin agrega-validacion
# From here, the PR is opened in the GitHub web interface:
# a "Compare & pull request" button appears.
# With GitHub's official CLI (gh) you can open it from the terminal:
gh pr create --base main --head agrega-validacion \
--title "Agrega validacion de login" \
--body "Valida email y password antes de enviar"
# Check the status of your PRs
gh pr status
Confusing the PR with a Git command: it isn't one, it's a feature of the hosting platform (GitHub, GitLab, etc.). Another mistake is opening huge PRs with dozens of unrelated changes: PRs should be small and focused so they can be reviewed well. Also, forgetting to push the branch (git push) before trying to open the PR.
"A Pull Request is a request to integrate the changes from one branch into another through a platform like GitHub. Its main purpose is code review: I push my branch, open the PR, and the team comments, suggests changes, and approves, plus the automated tests run. When everything's good, it gets merged. It's not a Git command, but a GitHub feature. It helps with quality and sharing knowledge; that's why it's best to keep them small and focused."
Is a Pull Request a Git command like git merge?
See answer
No. The Pull Request is a feature of hosting platforms (GitHub, GitLab, Bitbucket), not a Git command. Git on its own has no concept of a PR; it does have git merge, which is what happens under the hood when the PR is approved and integrated. The PR adds the layer of review, comments, and approval around that merge.