Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull requests: option to disable force push once opened #53

Open
mattklein123 opened this issue Sep 23, 2017 · 17 comments
Open

Pull requests: option to disable force push once opened #53

mattklein123 opened this issue Sep 23, 2017 · 17 comments

Comments

@mattklein123
Copy link

When people force push onto PRs it removes review history and makes reviews much harder to do. It would be really nice to have an option where we can disable force pushes to PRs once they are opened against a project.

@jeffmcaffer
Copy link

@mattklein123
Copy link
Author

@jeffmcaffer can you please explain how using branch protection rules I can block force pushes to someone's PR? I don't think this is possible. They own the PR branch. Thanks!

@mattklein123
Copy link
Author

cc @caniszczyk I would like to get this issue reopened. This is a major pain point and AFAIK there is no solution. Thanks!

@jeffmcaffer
Copy link

I misunderstood the scenario. Happy to reopen the issue.

To help the GitHub folks, can you say a bit more about the context and scenarios where this happens and how it would work with this feature in place?

@jeffmcaffer jeffmcaffer reopened this Jun 5, 2020
@mattklein123
Copy link
Author

The actual issue is that the GH code review system is completely broken when people force push in the sense that you lose any ability to see what has changed since the last time you looked. Obviously I would love this to be fixed but this is a huge issue.

So in terms of context, people open PRs, and then force push during reviews, which makes reviews incredibly difficult. Blocking force pushes on open PRs is just a hack to make this super annoying scenario impossible until the review system can be fixed.

@jeffmcaffer
Copy link

got it. Stepping back, in your scenarios why are people force pushing and what would they do as an alternative if they could not force push?

@mattklein123
Copy link
Author

got it. Stepping back, in your scenarios why are people force pushing and what would they do as an alternative if they could not force push?

Usually a combination of needing to fix DCO (another major issue, this needs to be built into GH directly), being bad at git, or just not understanding the problem. We want them to merge master and add commits and never force push to avoid breaking the review experience.

@kpfleming
Copy link

I can see value in allowing this, it definitely has to be opt-in. Force-pushing to PR branches is very valuable when the PR consists of a series of logical changes in separate commits (as it should unless it's small) and those commits should be kept when the PR is merged. Addressing review feedback involves changing the commits, not adding new commits which land on top of them, in that workflow.

@craigez
Copy link

craigez commented Jun 8, 2020

How do people get their PR rebased onto the last changes on the main branches without force pushing? That's another common reason I see for doing a force push, especially if the changes in the main branch of the project are conflicting and the rebase is needed to resolve these.

@mattklein123
Copy link
Author

How do people get their PR rebased onto the last changes on the main branches without force pushing? That's another common reason I see for doing a force push, especially if the changes in the main branch of the project are conflicting and the rebase is needed to resolve these.

Merge master. There is no reason to ever force push.

Again, force pushing itself is not the problem, it's the broken code review system. I'm just trying to have a workaround that saves us a massive amount of pain from a project maintainer perspective.

@timherby
Copy link

timherby commented May 4, 2021

+1 on preventing force-pushes for a whole repo (not on a per-branch basis). The code review system doesn't track properly after a force-push. Also, we're talking about an option, not a requirement that everyone use it. Our organization uses merge-commits, and we do want to track what got changed in each commit. Addressing PR feedback is a matter of adding new commits to fix the issues, not modifying history. So this option would be highly valuable to our process.

@prongs
Copy link

prongs commented Apr 5, 2022

Can this be provided as a repo-level setting?

@yoavsion
Copy link

yoavsion commented Sep 8, 2022

What's the status of this issue? Is this being reviewed? Considered? 🙏🏻

@marckhouzam
Copy link

I've recently noticed that next to a forced-push line in the PR, there is a "compare" button which allows to see the difference between the current version of the PR and the one before the forced push. That helps.

Without that I personally keep a branch of a PR version on my machine before pulling the new forced-push version. It's annoying but it's the best I could think of.

@konsalex
Copy link

+1 for this feature

@amtoine
Copy link

amtoine commented Apr 29, 2023

it's not very usefull, but all has already been said in there...
+1 for this feature, that would be amazing ✨ 😊

@silverwind
Copy link

I just had a commit I pushed to a contributor's branch eliminated because they carelessly force-pushed over it. Would definitely appreciate an option to disable force-push in pull request branches too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests