diff --git a/Library/Contributions/cmd/brew-test-bot.rb b/Library/Contributions/cmd/brew-test-bot.rb
index 7b66ddd33ca105f7ee217d41c03d9567354dc0e0..e19272d3047c25081dc261a0ceb0d6f3e632ae45 100755
--- a/Library/Contributions/cmd/brew-test-bot.rb
+++ b/Library/Contributions/cmd/brew-test-bot.rb
@@ -288,8 +288,8 @@ class Test
     git 'stash'
     git 'am --abort 2>/dev/null'
     git 'rebase --abort 2>/dev/null'
-    git 'checkout -f master'
     git 'reset --hard'
+    git 'checkout -f master'
     git 'clean --force -dx'
   end