We need better guidance as to how to do PRs and properly review code #186306
Replies: 3 comments
|
A simple team workflow that usually works well is:
What problem is being solved
Comment for suggestions or questions
For a team that is still learning GitHub, I would also create a short internal PR checklist and use the same workflow for every repository. Consistency helps much more than trying to create a complicated process immediately. GitHub’s pull request review documentation and review quickstart are also good references for the team. |
This comment was marked as spam.
This comment was marked as spam.
|
What you are experiencing isn't a lack of GitHub UI training—it's a process and hygiene issue known as branch drift and improper merge conflict resolution. No course on GitHub.com will fix this on its own, because the interface allows people to force bad code into Here is what is happening mechanically, why it keeps wiping out your code, and the specific controls you can put in place to stop it. What Your Colleague Is Doing WrongWhen a branch stays open for weeks or months, its history freezes in time while
How to Fix This in Your GitHub OrganizationTo eliminate code regressions like your missing 1. Turn On "Require Branches to Be Up to Date Before Merging"In your repository settings (Settings > Branches > Branch protection rules for
What this does: GitHub will literally disable the "Merge" button on any PR whose base branch ( 2. Auto-Delete Merged BranchesIn repository settings (Settings > General > Pull Requests):
What this does: As soon as a PR merges, GitHub deletes the remote feature branch. This prevents developers from casually pulling from an old branch and stacking new work on top of dead history. 3. Establish a Short-Lived Branch PolicyAdopt a standard workflow (like GitHub Flow or Trunk-Based Development) with three non-negotiable team rules:
4. Use
|
Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Question
Body
We've been using GitHub Enterprise, with an Organization where we keep all of our code, for about two years now. For the most part, it is going well, but I do see some problems related to PRs, reviewing code, creating code, and merging from one branch to another with a PR.
I've taken the GitHub skill that covered doing pull requests. That was a good, basic tutorial. I don't know if my colleagues have taken it or not. I suspect that a few have, but the majority haven't. It's been a few years since I took that skill, so I don't remember all the details, but if memory serves it showed how to create a PR in the GitHub.com interface, assigning it to a colleague. Or accepting a PR assigned to you. Some basic merge conflict resolutions skills, etc. Pretty straight forward.
But that doesn't cover what I sometimes see here. What I've seen is a colleague will create a branch in a repo. Then he'll do work in that branch and create a PR to merge changes back to main. All fine and good. But he'll leave that branch around for weeks, even months. Later, when other changes need to be merged into main. He will duplicate whatever was done in some other branch into his branch, which is now weeks or months out of date. And then he'll create a PR, someone else will review it and merge all that stuff into main.
I'm sure that is causing us problems. For example, today I've put the
target="_blank"into the anchor tag on a web page. For the third time, because it has been removed by other PRs wiping it out. And I'm sure that this colleague and others who do the same thing, are what's causing the problem.The GitHub skill to teach basic PR and code review, doesn't cover this situation at all. And colleagues do this over and over again. We spend a fair amount of rework, because of this. Is there a better, more advanced GitHub skill that will cover how to avoid re-introducing code that has been replaced, with old code deemed wrong?
All reactions