diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index 7e6473e..a4c1831 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -34,7 +34,11 @@ class Rbpkg::Repo
def checkout(branch)
verbose(3, "repo(#{name.inspect}).checkout")
sh_branch=sh_quote(branch)
- cmd! "cd #{sh_quote(src_dir!)} && git fetch #{sh_quote(remote)} #{sh_branch} && git checkout #{sh_branch} -- && git submodule update"
+ cmd! "cd #{sh_quote(src_dir!)} && git fetch #{sh_quote(remote)} #{sh_branch}"
+ cmd! "cd #{sh_quote(src_dir!)} && git reset --hard"
+ cmd! "cd #{sh_quote(src_dir!)} && git checkout #{sh_branch} --"
+ cmd! "cd #{sh_quote(src_dir!)} && git reset --hard"
+ cmd! "cd #{sh_quote(src_dir!)} && git submodule update"
end
def ci(ref, commit)