--- gitlab-ci-multi-runner/shells/abstract.go~ 2017-05-02 13:12:18.000000000 +0300 +++ gitlab-ci-multi-runner/shells/abstract.go 2017-05-16 08:10:46.528840805 +0300 @@ -96,7 +96,11 @@ func (b *AbstractShell) writeCheckoutCmd(w ShellWriter, build *common.Build) { w.Notice("Checking out %s as %s...", build.GitInfo.Sha[0:8], build.GitInfo.Ref) - w.Command("git", "checkout", "-f", "-q", build.GitInfo.Sha) + if build.GitInfo.RefType == common.RefTypeTag { + w.Command("git", "checkout", "-f", "-q", build.GitInfo.Sha) + } else { + w.Command("git", "checkout", "-fq", "-B", build.GitInfo.Ref, build.GitInfo.Sha) + } } func (b *AbstractShell) writeSubmoduleUpdateCmd(w ShellWriter, build *common.Build, recursive bool) {