Git & GitHub
/Beginner
Draft Pull Requests
Definition
A special state for a Pull Request that clearly indicates the code is a work in progress, preventing it from being accidentally merged and suppressing review notifications.
Explain Like I'm New
Sometimes you want to show your code to a coworker to ask a question, but the code is half-broken and not ready to be officially reviewed. You open it as a 'Draft'. The merge button is greyed out and physically locked so nobody can accidentally deploy your broken code.
Real World Example
Opening a Draft PR at the start of the week just to use it as a checklist, and clicking 'Ready for Review' on Friday when you finish the feature.
Common Use Cases
- •Early feedback
- •Preventing accidental merges of unfinished code
Terminal Output
bash / terminal
/*
How to create a Draft PR:
1. Push your branch to GitHub.
2. Click 'Compare & pull request'.
3. Instead of clicking the big green 'Create pull request' button,
click the little dropdown arrow next to it.
4. Select 'Create draft pull request'.
*/
Interview Questions
basic
- Can a Draft PR be merged?
intermediate
- Does opening a Draft PR trigger notifications to code owners?