diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb
index 8bb0fa057417691bfa525a6b630c76947234c672..3b8dc11f9d633ea257e23ba3c0ee64af1b565f38 100644
--- a/Library/Homebrew/dev-cmd/update-test.rb
+++ b/Library/Homebrew/dev-cmd/update-test.rb
@@ -32,6 +32,8 @@ module Homebrew
       commit
     elsif date = ARGV.value("before")
       Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp
+    elsif ARGV.include?("--to-tag")
+      Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1].chomp
     else
       Utils.popen_read("git", "rev-parse", "origin/master").chomp
     end