From 966b3c4e97562ae098f435d412eb403e04a196bb Mon Sep 17 00:00:00 2001 From: chriswalz Date: Thu, 18 Mar 2021 00:41:11 -0400 Subject: [PATCH] fix bit sync pulling even when force push fails (e.g. when there's a protected branch) --- cmd/sync.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/sync.go b/cmd/sync.go index 7678384..221620b 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -53,7 +53,12 @@ sync local-branch RunInTerminalWithColor("git", []string{"pull", "-r", upstream, currentBranch}) return } else if ans == optionMap["force"] { - RunInTerminalWithColor("git", []string{"push", upstream, currentBranch, "--force-with-lease"}) + err := RunInTerminalWithColor("git", []string{"push", upstream, currentBranch, "--force-with-lease"}) + if err != nil { + fmt.Println("Force push failed") + fmt.Println(err) + return + } // dont return user may have additional changes to save } else { fmt.Println("Canceling...")