diff --git a/app/views/commits/index.html.haml b/app/views/commits/index.html.haml
index 7999b94c..b9650145 100644
--- a/app/views/commits/index.html.haml
+++ b/app/views/commits/index.html.haml
@@ -12,7 +12,7 @@
\/
%a{:href => "#"}= params[:path].split("/").join(" / ")
-.right= render "projects/refs"
+.right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) }
%div{:id => dom_id(@project)}
= render "commits"
diff --git a/app/views/projects/_refs.html.haml b/app/views/projects/_refs.html.haml
index f7712d3d..60b17c7f 100644
--- a/app/views/projects/_refs.html.haml
+++ b/app/views/projects/_refs.html.haml
@@ -1,4 +1,4 @@
-= form_tag project_commits_path(@project), :method => :get, :class => "project-refs-form" do
+= form_tag destination, :method => :get, :class => "project-refs-form" do
= select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select"
diff --git a/app/views/projects/_tree.html.haml b/app/views/projects/_tree.html.haml
index f70bbb7a..8fdf72f0 100644
--- a/app/views/projects/_tree.html.haml
+++ b/app/views/projects/_tree.html.haml
@@ -17,7 +17,7 @@
\/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
- .right= render "projects/refs"
+ .right= render :partial => "projects/refs", :locals => { :destination => tree_project_path(@project) }
.clear
#tree-content-holder