Git & GitHub Course
Git & GitHub
/
Beginner

Creating a Pull Request

Definition

The process of opening a PR on GitHub, which involves selecting a base branch, a compare branch, writing a descriptive title, and providing context in the description body.

Explain Like I'm New

When you push a new branch to GitHub, a big green button automatically appears saying 'Compare & pull request'. Clicking it opens a form where you write a title and a description (using Markdown) to explain to your team what your code does.

Real World Example

Writing a great PR description: 'This PR fixes Issue #42. I added a debounce function to the search bar so it stops crashing the database when users type too fast. Attached is a screenshot of the new UI.'

Common Use Cases

  • •Initiating a code review

Interactive Example

Interview Questions

basic

  • What is the 'Base' branch in a Pull Request?

intermediate

  • How do you automatically close an Issue when a PR is merged?

Flash Cards

Question

What is the Base branch?

Click to reveal answer
Answer

The Base branch is the destination (usually `main`). The Compare branch is your feature branch. You are requesting to pull the Compare branch INTO the Base branch.

Question

Automatically close issue?

Click to reveal answer
Answer

Include special keywords in your PR description. If you type `Fixes #42` or `Closes #42` in the PR description, GitHub will magically close Issue #42 the exact second your PR is merged.