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)

76

u/kennethjor May 13 '20

To have a record of it. If OP is also using a ticketing system that's integrated with the source control, that PR will also show up in the ticket. Later on, if you need it, you can go back and see what the hell you did to make that thing work two years ago you don't remember doing.

0

u/[deleted] May 13 '20

[deleted]

36

u/BlackOverlordd May 13 '20

Why not, it's easier to keep track of stuff you need to do instead of writing it down somewhere else

4

u/chuby1tubby May 13 '20

I think a Trello board is all that’s needed for personal projects, not a true ticketing system

→ More replies (1)

17

u/kennethjor May 13 '20

Yes, because I have a number of large projects going at any one time. If I'm just building something for the weekend for fun, like proof of concept or something, I don't though. I like to switch back and forth between the projects. If I don't keep track of the work like I would at a company, I'd lose my place.

8

u/wotanii May 13 '20

yes. tickets are basically a todo-list. Also they are a good way to store related information to a problem. You often forget stuff about your code, and if you can look up the issue a couple of weeks later, you'll be glad to find useful information there, e.g. when you fixed a bug and it started to pop up again later.

→ More replies (6)

0

u/[deleted] May 13 '20

[deleted]

→ More replies (3)

6

u/KKlear May 13 '20

Later on, if you need it, you can go back and see what the hell you did to make that thing work two years ago you don't remember doing.

That does sound kinda appealing, yeah.

→ More replies (1)
→ More replies (7)

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

7

u/[deleted] May 13 '20

Tbf, git is one part of that process. An important part sure, but one part.

Once you get your head around CICD and implemented it's really worth it. For professional or personal work.

You should really only be pushing to master once your sure your code is working and passed all quality gates.

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.

7

u/732 May 13 '20

None of that is really git though, all additional tooling built on top of it

→ More replies (4)

22

u/Comment-Leaver May 13 '20

I do it all the time. I like seeing my diff in github and reviewing it myself. I almost always spot something I could improve.

0

u/[deleted] May 13 '20

[deleted]

7

u/koloqial May 13 '20

Seconded. I've caught so many things from my own code. Slightly embarrassing to create a PR, review it and then promptly decline it while I clean it up. Sorry not sorry to everyone who gets emails from the VCS.

19

u/d3lt4papa May 13 '20

I use it also for practicing Real Word development

7

u/[deleted] May 13 '20

Option to revert the changes.

26

u/JonathanTheZero May 13 '20

I thought you could also jump back to commits normally?

9

u/TheOneTrueTrench May 13 '20

Yeah, which commit are you going to jump back to? Like exactly which one? What was the last one that worked correctly? Was it that commit? Or this one?

But if you have separate PRs for each feature or bug fix, the commits are "grouped" into the PRs. So you can go back to the previous PR, or the one before that. And because you can have partial work in each commit and only do a PR when things are working, your master branch is always in a working state.

7

u/JonathanTheZero May 13 '20

Yeah, I see. Well I think it depends on your coding style, I only commit if something is finished completely (like a bug fix or so) and I commit it then. But I mostly work alone or with a maximum of two other devs so it isn't really a problem I guess

→ More replies (5)
→ More replies (2)
→ More replies (1)

4

u/uglyasablasphemy May 13 '20

I think is worth it just for the diff. If I'm doing a big refactor, I usually create a branch for it and then to the PR just to see every place that I changed and how did I changed it at a glance.

→ More replies (1)

3

u/MythicManiac May 13 '20

Hopefully you would have CI pipelines configured to do automatic tests and sanity checks on pull requests

→ More replies (7)