-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
add support for git push --force-if-includes
#2333
add support for git push --force-if-includes
#2333
Conversation
ad0d0db
to
6cfafac
Compare
Reading the docs on the new arg, I don't really understand how it works, or whether it would be unnecessarily strict. Do you have insights into that @Ryooooooga ? As for the code itself, it's fantastic! Being able to easily check the git version is greater than some version will be very useful |
@jesseduffield If |
6cfafac
to
ba78ddd
Compare
Can you confirm my understanding is correct:
In terms of lazygit, given auto-fetch is enabled by default (and I think that it should be), it sounds like using Does that all sound right? |
ba78ddd
to
e00f248
Compare
@jesseduffield My thoughts are the same as yours. This PR will cause force push to fail in some cases, but it will have protected the user from loss of commits. |
alrighty let's merge it and see if it causes any issues |
This flag breaks my workflow. Obviously you shouldn't make changes for one user, but is there any chance --force-if-includes could be made an option, or include an option to disable it? My use case is a CI/CD tool making commits to a repo only I use. In 0.36.0, I could force push my commits as I don't care about commits from the tool being overwritten. Either way, lazygit is great and I can always compile my own version if necessary (reverted to 0.36.0 for now). |
I wasn't around yet when the original discussion happened, so here's a very late contribution:
That's not quite true. This option is very useful, and it did save my ass a few times already, e.g. when I work on the same branch from both my Mac and Windows machines and push commits from either. However, I have also run into false positives with it more than once, and then that's a bit annoying because the only way around it is to drop to the command line and do a As for @mtritab's use case, I'm not sure how I feel about it; it does seem strange to routinely wipe out commits that someone else (even a tool) commited. I wonder if you will learn to appreciate the safety guard when you ever work from multiple machines and overwrite your own commits by accident. 😄 Anyway, one way to solve this use case could be to remove the option again from lazygit and let people turn it on in their git config if they want it ( |
I agree: given this can be handled in the git config, I'm happy to let users do that. |
Indeed, on second thought, it seems better to follow the user's |
PR Description
Please check if the PR fulfills these requirements
go run scripts/cheatsheet/main.go generate
)docs/Config.md
) have been updated if necessary