Improve workflow when force-pushing during code reviews #3478
Replies: 8 comments 20 replies
-
Edit: Moved into "General Feedback" category, where it is well-placed. So the below discussion is obsolete. Not sure if this was the right place to post this feature request 👉 Reposted to github.community. |
Beta Was this translation helpful? Give feedback.
-
I would also like to see less clutter on the PR page when iterating on in-progress changes. Especially for draft PRs – I'm reluctant to open drafts with incomplete changes to avoid clutter on the PR page. This defeats the purpose of having a "draft" state. In Azure DevOps, there is a similar amount of verbosity in commits/force-pushes, but it's not so bad because the PR page displays updates with most recent at the top. I prefer that over GitHub PRs where you have to scroll all the way down just to see the most recent changes/comments. |
Beta Was this translation helpful? Give feedback.
-
Documented my prior experience with this in #8808 - in my experience it's a significant source of friction between people who want to keep the review history and others who want to optimize for the source history. |
Beta Was this translation helpful? Give feedback.
-
I don't know if this was a recent change, but the designers somewhat addressed the verbosity issue here by compressing back-to-back force-pushes with a message <username> force-pushed the <branch> branch n times, most recently from <commit> to <commit>. However, the |
Beta Was this translation helpful? Give feedback.
-
One more thing that would be really helpful: The diff should not show rebased commits from the target branch of the PR. If a feature branch gets rebased on the target branch and there are also code changes in the feature branch, the diff for the force pushes shows the changes of all commits from the target branch as well. Since they have already been reviewed and merged, it's often very hard if not impossible for reviewers to identify the actual code changes of the push. |
Beta Was this translation helpful? Give feedback.
-
I sure hope this gets implemented one day! I think this is an area that GitLab does better than GitHub.
This would be a killer code review feature for GitHub if it offered it in the web UI. |
Beta Was this translation helpful? Give feedback.
-
Another problem with the current situation is that when there were many force-pushes since a review, one has to look at all of them separately. It would be much better if Github kept track of the state (commit) of a PR when a review is submitted, and then offer a "show changes since this review" button that covers all the force-pushes (and other pushes) since then. Right now, I don't think there is even a manual way to get that commit, so I often have no choice but to re-review and entire PR, losing a lot of time. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately GitHub's PR flow of multiple commits per code review is fundamentally broken, and I doubt it will ever get properly fixed without changing the model. This was already clear in 2017 when I first submitted isaacs/github#999 (and also isaacs/github#997 and isaacs/github#998). At that point I'd used both GitHub and Gerrit for 5+ years, and it was already very obvious how much better Gerrit's 1-commit-per-review model was, even before Gerrit enjoyed substantial improvements in UX etc. So I fear this is flogging a dead horse. One of the biggest flaws of this model is that GitHub has no stable unique id per commit in the PR, so it can't keep track of which commit is which during a force-push, since a force-push can add, remove, amend, and reorder commits arbitrarily. If a new patch-id appears, it's impossible to tell whether that is related to a previous commit. Consequently the UI has no way to present the change from the previous version of the PR in an intelligible way. Gerrit solves this by adding a stable unique id to every commit message as part of the review submission request, and it's a total game-changer. This broken model leads to many additional problems, not least huge pains when trying to stack PRs on top of other PRs. Many attempts have been made to solve this, but unfortunately they are all just bandaids. The real solution is to limit PRs to 1 commit, use stable uuids per commit, use git commit's graph to natively express dependencies between reviews, and provide tooling which makes it quick and easy to submit a chain of n commits as n PRs. In fact, it's possible to do this today using Gerrit with some extra GitHub compatibility plugins. IIRC open source projects can even get hosting for free from GerritHub. The drawback is that it's not a well-trodden path, so things like GitHub Actions will require effort to integrate. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The Github Flow article encourages pushing new commits while iterating over a pull requests during code reviews. However, this sometimes leads to a messy commit history and some teams prefer to continuously force-push clean commit histories rather than pushing little review commits.
This workflow doesn't work well with Github yet, unfortunately. In 2018, Github added a hyperlink to the word
force-pushed
in the conversation timeline to show the diff after a force-push, which is already a great improvement.The following points are still missing in the Web UI to support smooth force-push review iterations:
force-pushed
shows the diff, but no line-comments can be made.Happy to add more points. Note that Gitlab and other platforms have better support for this kind of workflow for some time now.
Related issue: isaacs/github#999
If you want to see these features being implemented, please vote by clicking on the ⬆️ above the counter. Giving a 👍 does not count as a vote, see also #3474
Beta Was this translation helpful? Give feedback.
All reactions