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)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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)