summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-11-17 14:50:12 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-11-21 22:07:14 +1100
commit07cbae40191a88a18b68d724b4c0983ad7790fa2 (patch)
tree00c1511fc078dcd5dae2b89bd96c6d8213874e59 /pkg/commands
parentb42202ea1c82d93d828fec38ddfdc073c041dec9 (diff)
support setting upstream
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index c2e12491d..9dda1b2d2 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -1087,3 +1087,7 @@ func (c *GitCommand) IsHeadDetached() bool {
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string) error {
return c.OSCommand.RunCommand(fmt.Sprintf("git push %s --delete %s", remoteName, branchName))
}
+
+func (c *GitCommand) SetBranchUpstream(remoteName string, remoteBranchName string, branchName string) error {
+ return c.OSCommand.RunCommand(fmt.Sprintf("git branch --set-upstream-to=%s/%s %s", remoteName, remoteBranchName, branchName))
+}