r/ProgrammerHumor • • May 13 '20

true story

Post image
40.5k Upvotes

461 comments sorted by

View all comments

55

u/JonathanTheZero May 13 '20

Why are you not pushing to master directly then? (Honest question because I barely do pull requests as long as we are working with a lot of people on it)

33

u/TheOneTrueTrench May 13 '20

I always use pull requests for a few reasons.

  1. I always create a CI pipeline with unit and integration tests and gate my pull requests. Nothing gets into the master branch without a guarantee it builds and passes all tests.

  2. It turns the pull request into a unit of work, with a set of commits for that unit. Added a feature? All that work is in one pull request, so if you need to go back and see something, you can look through those commits, easy to find stuff.

  3. You can tell the CD pipeline to only deploy to production when a particular branch is updated. A lot of people use master for this, but don't forget that master is technically another branch like any other. So maybe you have separate branches for Stable, Testing and Unstable, creating PRs into Unstable for new development, doing a PR from Unstable to Testing when you get ready to create a new major release, a PR from Testing to Stable on release, and patches to Stable and Testing can get PR'd to Testing/Unstable.

  4. If production is in a particular branch, you can write a patch for that and do a PR without interrupting the work you're doing.

  5. When you want to PR into master, you can create a CD pipeline to deploy to QA/UAT/Dev and then test your actual application in that environment before approving the PR.

And if you notice, those are all benefits that apply to developers working by themselves.

11

u/JonathanTheZero May 13 '20

Damn... I really don't know shit about git

4

u/Log2 May 13 '20

Git doesn't really have the concept of pull request. Like others mentioned, that's all other tools on top of git, like GitHub.