1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

popup force push confirmation panel if the local branch has diverged from the upstream branch

This commit is contained in:
Jesse Duffield
2018-08-19 21:28:13 +10:00
parent e6712832b5
commit 4d2346f80a
3 changed files with 33 additions and 9 deletions

View File

@ -270,8 +270,12 @@ func (c *GitCommand) Pull() error {
}
// Push push to a branch
func (c *GitCommand) Push(branchName string) error {
return c.OSCommand.RunCommand("git push -u origin " + branchName)
func (c *GitCommand) Push(branchName string, force bool) error {
forceFlag := ""
if force {
forceFlag = "--force-with-lease "
}
return c.OSCommand.RunCommand("git push " + forceFlag + "-u origin " + branchName)
}
// SquashPreviousTwoCommits squashes a commit down to the one below it