diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-17 21:22:07 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-18 21:29:06 +1100 |
commit | 1be0ff8da738c706e1aff8111428b36a5efced44 (patch) | |
tree | 3f4b90cea75e3803fa0799f76c8e57e34c8cbbeb /pkg/commands/git.go | |
parent | 2169b5109f508a28848ced699f698ca3e4ed2c49 (diff) |
better upstream tracking and allow renaming a branch
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 00ec296de..2bd852de8 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -343,7 +343,7 @@ func (c *GitCommand) CurrentBranchName() (string, error) { match := re.FindStringSubmatch(output) branchName = match[1] } - return utils.TrimTrailingNewline(branchName), nil + return strings.TrimSpace(branchName), nil } // DeleteBranch delete branch @@ -1163,3 +1163,7 @@ func (c *GitCommand) GetPager(width int) string { func (c *GitCommand) colorArg() string { return c.Config.GetUserConfig().GetString("git.paging.colorArg") } + +func (c *GitCommand) RenameBranch(oldName string, newName string) error { + return c.OSCommand.RunCommand("git branch --move %s %s", oldName, newName) +} |