diff --git a/lib/heroku_san/tasks.rb b/lib/heroku_san/tasks.rb
index <HASH>..<HASH> 100644
--- a/lib/heroku_san/tasks.rb
+++ b/lib/heroku_san/tasks.rb
@@ -109,7 +109,7 @@ end
 desc "Deploys, migrates and restarts latest code"
 task :deploy => :before_deploy do
   each_heroku_app do |name, app, repo|
-    branch = `git branch`.scan(/^\* (.*)\n/).to_s
+    branch = `git branch`.scan(/^\* (.*)\n/).flatten.first.to_s
     if branch.present?
       @git_push_arguments ||= []
       system_with_echo "git push #{repo} #{@git_push_arguments.join(' ')} #{branch}:master && heroku rake --app #{app} db:migrate && heroku restart --app #{app}"
flatten and get the first branch element

Because Array#to_s in <I> doesn't returns the first element as a string but [['master']]