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

When local branch diverges from the remote and you're about to force push, the warning should prompt the user enter some text instead of just pressing enter. #3468

Open
iltenahmet opened this issue Apr 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@iltenahmet
Copy link

Is your feature request related to a problem? Please describe.
When the local branch has diverged from the remote and you're about to force push, there is a super useful warning that says your branch has diverged from the remote branch, Press <esc> to cancel, or <enter> to force push. Unfortunately, I ended up pressing enter out of habit too many times because it's just muscle memory at this point. We could avoid so many accidental force pushes if we had prompted to user the enter a word instead.

Describe the solution you'd like
The pop-up could be changed as your branch has diverged from the remote branch, Press <esc> to cancel, or type "force" to force push. It can be another word, or it could be something else that prevents the user from just pressing enter out of habit.

Additional context
Many large projects employ this tactic because it's too easy to press buttons without reading what they do. For example, when you're changing the visibility of a repo on Github, they ask you to type the name of the repo in addition to the warning pop-up. This ensures people don't just press enter out of habit without even reading what the pop-up says.

@iltenahmet iltenahmet added the enhancement New feature or request label Apr 1, 2024
@belyakov-am
Copy link
Contributor

This looks useful to me too. And I would also consider changing pop-up for discard action in the same way.

However, I would prefer having a config options for each action (forse push, discard, etc) and enabling/disabling them separately.

@AndrewSav
Copy link
Contributor

#2009 IMO this should be configurable, if someone prefers to force push fast, they should be able to do so, but those who wants extra safety should also have that option.

@simondoesstuff
Copy link

🙏 Just did an inadvertent force push resulting in 2 weeks of a collaborator's deleted work and 3 hours finding the dangling commits to recover.

@iltenahmet
Copy link
Author

iltenahmet commented Apr 9, 2024

@simondoesstuff this is exactly why I opened this issue. Based on the discussion on #2009, we are not the first ones to force push by mistake and lose hard-to-recover work. The potentially dire consequences of accidental force pushes are far greater than the benefits of being able to force push fast.

I agree that it should be configurable, but it makes sense to have the safer option as the default, especially because I think most people will not go through the extra step of configuring this until they make an inadvertent force push.

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

No branches or pull requests

4 participants