summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-19 21:28:13 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-19 21:28:13 +1000
commit4d2346f80ae06ae58dc9083bd1ada50c31e396ac (patch)
treea459a7b66ae00eebdb4affaa796f7feb3330d65f /pkg/commands/git.go
parente6712832b502bf893d11d0c891f5ab1b69242fec (diff)
popup force push confirmation panel if the local branch has diverged from the upstream branch
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 557e6a8c0..bf9aa6646 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -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