By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
For engineers who need to ship code safely, review changes efficiently, and avoid production fires.
A Pull Request (PR) is GitHub’s (and GitLab’s/Azure DevOps’) way of saying: “Hey team, I’ve got some changes ready—can you check them before they merge into the main codebase?”
main
You’re a backend engineer working on a payment processing system. A teammate opens a PR to update the API’s rate-limiting logic. If you merge it without reviewing: - The new logic might block legitimate users (false positives).- The change could conflict with another team’s work, breaking the checkout flow.- A missing test could let a bug slip through, causing failed transactions.
PRs are your last line of defense before code hits production.
master
dev
feature/payment-fix
WHERE user_id = ?
git add
git commit
git push
Scenario: You’re adding a new API endpoint (/health) to a Node.js app. Here’s how to do it the right way.
/health
# Start from the latest main branch git checkout main git pull origin main # Create and switch to a new branch git checkout -b feature/add-health-endpoint
Why?- Never work directly on main. Branches isolate changes.- Branch names should be descriptive (feature/, fix/, docs/ prefixes help).
feature/
fix/
docs/
Edit server.js:
server.js
// Add a new endpoint app.get('/health', (req, res) => { res.status(200).json({ status: 'OK' }); });
Commit the change:
git add server.js git commit -m "feat: add /health endpoint"
Pro Tip:- Use Conventional Commits (feat:, fix:, docs:) for clarity.- Keep commits small and focused (one logical change per commit).
feat:
fix:
docs:
git push origin feature/add-health-endpoint
Why?- Pushing early lets teammates see your work (even if it’s incomplete).- Enables CI/CD pipelines to run tests on your branch.
feature/add-health-endpoint
``markdown ## Description Adds a
## Changes - New /health route in server.js
## Testing - Manually tested with curl http://localhost:3000/health - Added unit test in health.test.js (see commit abc123)
curl http://localhost:3000/health
health.test.js
## Screenshots (if applicable) N/A ```
Production Insight:- A good PR description answers: - What changed? - Why was this change needed? - How was it tested? - Link to related issues (e.g., “Fixes #123”).
@alice
enhancement
backend
Why?- Explicit reviewers reduce bottlenecks (vs. hoping someone notices).- Labels help triage PRs (e.g., bug vs. feature).
bug
feature
req
user_id
Production Insight:- Be kind but direct. Code reviews are about the code, not the person.- Prioritize blocking issues (e.g., security flaws) over nitpicks (e.g., “I prefer single quotes”).
bash # Edit server.js to add the timestamp git add server.js git commit -m "fix: add timestamp to /health response" git push origin feature/add-health-endpoint
Why?- GitHub doesn’t notify reviewers of new commits—you must re-request.- Small, incremental updates make reviews easier.
Production Insight:- Never force-merge. If checks fail, fix them first.- Delete branches after merging to avoid clutter.
gitleaks
.github/PULL_REQUEST_TEMPLATE.md
Fixes #123
@team-frontend
@security
BREAKING CHANGE:
npm test
pytest
git commit --amend
git merge main
GitHub certifications (e.g., GitHub Actions) and DevOps exams (e.g., AWS DevOps Pro) test PR workflows. Here’s what to expect:
Trap: “Just tell people not to push to main” (not enforceable).
Merge Strategies:
Trap: “Always use rebase” (can cause issues with shared branches).
Status Checks:
Trap: “Merge anyway and fix later” (violates CI/CD principles).
Review Workflow:
Trap: “Merge anyway” (ignores feedback).
Draft PRs:
Challenge: 1. Fork this demo repo (or use your own).2. Create a branch fix/readme-typo.3. Fix a typo in the README.md (e.g., change “Hello World” to “Hello GitHub”).4. Open a PR, request a review from a teammate (or yourself), and merge it.
fix/readme-typo
README.md
Solution:
git clone https://github.com/your-username/Hello-World.git cd Hello-World git checkout -b fix/readme-typo # Edit README.md git add README.md git commit -m "fix: correct typo in README" git push origin fix/readme-typo # Open PR on GitHub, request review, merge.
Why It Works: - Follows the full PR workflow (branch → change → PR → review → merge).- Demonstrates how small, focused PRs work in practice.
git checkout -b feature/x
git checkout -b feature/login
git push origin feature/x
git push origin feature/login
gh pr create
gh pr create --title "Add login" --body "Fixes #123"
gh pr checkout 123
git rebase main
@mention
@alice please review this
!important
!important Use HTTPS instead of HTTP
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.