From 670f0e37c744d6cd9e4641a066b36f087d9ce2fa Mon Sep 17 00:00:00 2001 From: Glenn Vriesman Date: Thu, 29 Nov 2018 17:57:28 +0100 Subject: [PATCH] Added rebase functions --- pkg/commands/git.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index b78db1fa6..2b5044971 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -260,6 +260,19 @@ func (c *GitCommand) RenameCommit(name string) error { return c.OSCommand.RunCommand(fmt.Sprintf("git commit --allow-empty --amend -m %s", c.OSCommand.Quote(name))) } +func (c *GitCommand) RebaseBranch(onto string) error { + curBranch, err := c.CurrentBranchName() + if err != nil { + return err + } + + return c.OSCommand.RunCommand(fmt.Sprintf("git rebase %s %s ", onto, curBranch)) +} + +func (c *GitCommand) AbortRebaseBranch() error { + return c.OSCommand.RunCommand("git rebase --abort") +} + // Fetch fetch git repo func (c *GitCommand) Fetch() error { return c.OSCommand.RunCommand("git fetch")