diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-15 14:20:09 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-15 15:34:01 +1100 |
commit | 1c84f7731920e1970d52f81361d321268054e559 (patch) | |
tree | 077e68eb695b29fdf911f48a83c654b8bfb72f35 /pkg/commands/git_commands | |
parent | 8d8bdb948b089250c22f3ac4f549152a209dcdb2 (diff) |
always specify upstream when pushing/pulling
Diffstat (limited to 'pkg/commands/git_commands')
-rw-r--r-- | pkg/commands/git_commands/branch.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index 50dfc036b..59af77612 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -108,13 +108,8 @@ func (self *BranchCommands) GetGraphCmdObj(branchName string) oscommands.ICmdObj return self.cmd.New(utils.ResolvePlaceholderString(branchLogCmdTemplate, templateValues)).DontLog() } -func (self *BranchCommands) SetCurrentBranchUpstream(upstream string) error { - return self.cmd.New("git branch --set-upstream-to=" + self.cmd.Quote(upstream)).Run() -} - -func (self *BranchCommands) GetUpstream(branchName string) (string, error) { - output, err := self.cmd.New(fmt.Sprintf("git rev-parse --abbrev-ref --symbolic-full-name %s@{u}", self.cmd.Quote(branchName))).DontLog().RunWithOutput() - return strings.TrimSpace(output), err +func (self *BranchCommands) SetCurrentBranchUpstream(remoteName string, remoteBranchName string) error { + return self.cmd.New(fmt.Sprintf("git branch --set-upstream-to=%s/%s", self.cmd.Quote(remoteName), self.cmd.Quote(remoteBranchName))).Run() } func (self *BranchCommands) SetUpstream(remoteName string, remoteBranchName string, branchName string) error { |