diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb
index e7f7a7673b5410310350dc01675abfc75ddc1382..668de75f663fa1d6423fdd78562029707a679455 100644
--- a/lib/gitlab/satellite/satellite.rb
+++ b/lib/gitlab/satellite/satellite.rb
@@ -24,8 +24,8 @@ module Gitlab
       def clear_and_update!
         raise_no_satellite unless exists?
 
-        delete_heads!
         clear_working_dir!
+        delete_heads!
         update_from_source!
       end