How to make a good pull request

Conventional naming

Is very important to follow a consistent structure for your branches and commits depending on what you will be adding.

  • For your branch I recommend you depending on the change the following structure:
type/ticket_number + phrase of three words describing the change:feature/23-add-new-button

Good Description

The description is the cover letter of your work, and you should include everything you think is necessary to provide the necessary context for your reviewers.

What should have a good description?

  • Explanations of what you did: very small resume of what you did.
  • Links: ticket, design, or live demo: to give more context.
  • Screenshots or code snippets: to clarify or prove what you did.
  • Checklist: Things like “Reviewed by designers” or similar should suffice.

Keep it simple keep it small

  • Easier to merge.
  • Easier to design well.
  • Less blocking on reviews.
  • Simple to roll back.

What is Small?

  • The CL makes a minimal change that addresses just one thing.
  • There are no hard and fast rules about how large is “too large.” A 200-line change in one file might be okay, but spread across 50 files it would usually be too large.

Keep your Branch Up to date

Some benefits:

  • Test your integrated changes with the master branch.
  • Use the latest functionalities at the HEAD of the master branch.
  • Avoid merge conflicts before creating the pull request.

So what to do rebase or merge?

When you merge a branch, git creates a merge commit that can be discarded or amended if the conflict resolution goes poorly. Even if you have already pushed the bad merge commit to the public/authoritative repo, you can use git revert to undo the changes introduced by the merge and redo the merge correctly in a new merge commit.

Summary

  • Follow a good convention naming your commits and branch
  • Add a good description
  • Make the pull request small
  • Keep your branch up to date before and after creating the pull request
  • A good pull request makes a minimal change that addresses just one thing

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store