From 32e02a6575ab7feb8f421ee7ce3b2fa75b6ad381 Mon Sep 17 00:00:00 2001 From: Kaleb Olson Date: Tue, 22 Aug 2017 17:58:11 -0600 Subject: [PATCH] :bug: Changed from `checkout -f` to `reset --hard` to match fetch --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e4fc75a..3228187 100644 --- a/main.go +++ b/main.go @@ -107,7 +107,7 @@ func updateRepo(gitDir string, workTree string) error { // N.B., that git must have a ssh key statusCmd := exec.Command("git", "status", "-s") pullCmd := exec.Command("git", "fetch") - checkoutCmd := exec.Command("git", "checkout", "-f", "master") + checkoutCmd := exec.Command("git", "reset", "--hard", "origin/master") statusCmd.Env = env pullCmd.Env = env @@ -127,7 +127,7 @@ func updateRepo(gitDir string, workTree string) error { // Checkout master if output, err := checkoutCmd.CombinedOutput(); err != nil { - glog.Errorf("Error running `git checkout -f master` for %s in %s: %s", gitDir, workTree, output) + glog.Errorf("Error running `git reset --hard origin/master` for %s in %s: %s", gitDir, workTree, output) return errors.New("checkout failed") }