From bde6182c949918964612b14c0957b7683d9f98bd Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 14 Aug 2018 18:30:06 +1000 Subject: [PATCH] better git squash logic --- pkg/commands/git.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 6523dd747..e7a5212a2 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -278,7 +278,12 @@ func (c *GitCommand) Push(branchName string) error { // retaining the message of the higher commit func (c *GitCommand) SquashPreviousTwoCommits(message string) error { // TODO: test this - return c.OSCommand.RunCommand("git reset --soft HEAD^ && git commit --amend -m " + c.OSCommand.Quote(message)) + err := c.OSCommand.RunCommand("git reset --soft HEAD^") + if err != nil { + return err + } + // TODO: if password is required, we need to return a subprocess + return c.OSCommand.RunCommand("git commit --amend -m " + c.OSCommand.Quote(message)) } // SquashFixupCommit squashes a 'FIXUP' commit into the commit beneath it,