jesseduffield / jesseduffield/lazygit

Change default force push strategy

Open
#4,077 2 comments 6 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Is your feature request related to a problem? Please describe.**
I usually work on a branch and I do a lot of commits with `--amend` or changing the order of commits or editing previous commits, which leads to requiring a force push. Usually I'm the only one who works on that branch, but sometimes my teammates do a single commit on that branch, which we might forget to talk about. As I usually force push a lot, I don't look at fetch status of how many commits are changed on the remote and I might force push their changes.
Outside lazy git people usually use `git push --force-with-lease` which helps with this. Then they fetch and read the changes, and they can force push again. But in lazygit as it automatically fetches in the background, the `--force-with-lease` becomes useless, and it behaves like `--force` when a fetch has happened.

**Describe the solution you'd like**
Use `git push --force-with-lease --force-if-includes` as default, and it won't force push other people changes. Also add another commit without `--force-if-include` for other situations that we actually want to ignore other remote commits. Or ask in another dialog if we want to ignore their changes.

I think it's also a safer option, as lazygit fetches periodically by itself (and git don't).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.