diff options
Diffstat (limited to 'pkg/commands/git_commands/branch.go')
-rw-r--r-- | pkg/commands/git_commands/branch.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index d05738ef3..6a347b8ac 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -28,6 +28,17 @@ func (self *BranchCommands) New(name string, base string) error { return self.cmd.New(cmdArgs).Run() } +// CreateWithUpstream creates a new branch with a given upstream, but without +// checking it out +func (self *BranchCommands) CreateWithUpstream(name string, upstream string) error { + cmdArgs := NewGitCmd("branch"). + Arg("--track"). + Arg(name, upstream). + ToArgv() + + return self.cmd.New(cmdArgs).Run() +} + // CurrentBranchInfo get the current branch information. func (self *BranchCommands) CurrentBranchInfo() (BranchInfo, error) { branchName, err := self.cmd.New( |