summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index bd834e574..16b09faa7 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -398,13 +398,18 @@ func (c *GitCommand) Pull(ask func(string) string) error {
}
// Push pushes to a branch
-func (c *GitCommand) Push(branchName string, force bool, ask func(string) string) error {
+func (c *GitCommand) Push(branchName string, force bool, upstream string, ask func(string) string) error {
forceFlag := ""
if force {
- forceFlag = "--force-with-lease "
+ forceFlag = "--force-with-lease"
}
- cmd := fmt.Sprintf("git push %s-u origin %s", forceFlag, branchName)
+ setUpstreamArg := ""
+ if upstream != "" {
+ setUpstreamArg = "--set-upstream " + upstream
+ }
+
+ cmd := fmt.Sprintf("git push %s %s", forceFlag, setUpstreamArg)
return c.OSCommand.DetectUnamePass(cmd, ask)
}