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

support force push #274

Closed
extrawurst opened this issue Sep 6, 2020 · 7 comments · Fixed by #421
Closed

support force push #274

extrawurst opened this issue Sep 6, 2020 · 7 comments · Fixed by #421
Labels
enhancement New feature or request

Comments

@extrawurst
Copy link
Owner

see libgit2/libgit2#4286 for how to do force with libgit2

we should try to push first and if it fails we ask if we should force push, this way we only need one push command

@extrawurst extrawurst added the enhancement New feature or request label Sep 6, 2020
@extrawurst extrawurst added this to the v0.11 milestone Sep 16, 2020
@WizardOhio24
Copy link
Contributor

For this, would it not be better to create a separate command/key for it? Usually when you want to force push, you know, it's not like you usually push, fail and decide to force push, this would probably result in overwritten commits and annoy everyone else who was contributing who would then have to reset --hard or force push to sort out the branch. It would be more common to push, fail, rebase and push again.
Usually you would only force push if you had rewritten history and should only do it on a branch where you are the sole commiter. And if you had rewritten history, you'd know you have to force push.

So I think this should be on a separate key, perhaps Shift-P?

@alocquet
Copy link
Contributor

Hello.
My usage of force push is the one described by @WizardOhio24 : I force push when I rewrite my history.
I think we should use --force-with-lease option to avoid erasing the commits of another user.

@extrawurst
Copy link
Owner Author

extrawurst commented Oct 28, 2020

@WizardOhio24 ok lets do Shift+P but with confirmation popup

@extrawurst extrawurst removed this from the v0.11 milestone Dec 20, 2020
@GitMurf
Copy link

GitMurf commented Mar 26, 2024

WizardOhio24 ok lets do Shift+P but with confirmation popup

I know this is an old issue but this message seems like the intent is to have a confirmation popup for when you are force pushing. I would like that so I do not accidentally force push. did the confirmation get removed? is there a way I can change some configuration to require a confirmation before force pushing? Thanks!

@GitMurf
Copy link

GitMurf commented Mar 26, 2024

Nevermind! it appears the confirmation works as expected! The problem was I tried re-mapping shift+p to ctrl+p for force push with the following:

force_push: Some(( code: Char('P'), modifiers: "CONTROL")),

But I didn't realize that when you use control modifier, you have to make sure the character P is lowercase. So the correct re-mapping is this which works as expected with a confirmation. Thanks!

force_push: Some(( code: Char('p'), modifiers: "CONTROL")),

@cloudlena
Copy link

Does it actually do a push with --force or one with --force-with-lease now? If the latter, should we indicate that somewhere? When I was using the feature, I wasn't sure. That's why I came here 😅

@extrawurst
Copy link
Owner Author

@cloudlena its good ol --force

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

Successfully merging a pull request may close this issue.

5 participants