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

Allow disabling of force push #855

Open
nahtnam opened this issue May 22, 2020 · 7 comments
Open

Allow disabling of force push #855

nahtnam opened this issue May 22, 2020 · 7 comments

Comments

@nahtnam
Copy link

@nahtnam nahtnam commented May 22, 2020

Topic

So sometimes when I am pushing to a branch and it has diverged from the remote, a little pop up shows up saying would you like to force push. Instinctively I press enter instead of escape which ends up force pushing

Your thoughts

I was hoping there would be an option to disable this specific behavior or just disable force pushing all throughout lazygit.

I feel like this makes you look incompetent at work (because it implies you don't know how to merge/rebase) when in reality I'm just lazy 😂

@nahtnam nahtnam added the discussion label May 22, 2020
@lordlycastle
Copy link

@lordlycastle lordlycastle commented Jul 12, 2020

You need to force push after a rebase?

@nahtnam
Copy link
Author

@nahtnam nahtnam commented Jul 12, 2020

Nope. So lets say I make a commit on the branch develop, but someone pushed a commit to develop before me. When I push, lazy git would give the following error: 'Branch has diverged from remote'.

So then you:

  1. Press esc
  2. Pree p to pull (lazygit will auto merge)
  3. Press P to push

Now if you (out of habit) press enter instead of esc in step 1, it just immediately force-pushes and overwrites whatever is in the remote which I would say is pretty dangerous behavior.

@lordlycastle
Copy link

@lordlycastle lordlycastle commented Jul 14, 2020

Yeah fair enough. But some would say two people shouldn't be using the same branch; I won't but those people are everywhere!

@nahtnam
Copy link
Author

@nahtnam nahtnam commented Jul 14, 2020

I generally agree with that but here are two situations that are pretty common:

  1. You made a PR, and at the same time someone else pushes to master, you get a nice little button in the UI that allows you to merge master into your PR. You forget to pull locally and now you end up force pushing
  2. You are working directly on the develop branch. Some automated tool like dependabot updates your dependencies for you. You merge the PR, forget to pull and end up force pushing to develop
@jesseduffield
Copy link
Owner

@jesseduffield jesseduffield commented Aug 23, 2020

This one wouldn't be too hard to do if somebody was looking for a good first issue! You'd need to add a new config option to app_config.go and read it in pushFiles() in pkg/gui/files_panel.go

@fsmiamoto
Copy link
Contributor

@fsmiamoto fsmiamoto commented Aug 28, 2020

@jesseduffield I'd really like to tackle this one!

@jesseduffield
Copy link
Owner

@jesseduffield jesseduffield commented Aug 28, 2020

go for it @fsmiamoto, lemme know if you need anything!

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.