diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb
index 3d4d161a1a2d4265c83bcbfe7f9c931a0b98e667..c1a4611536da3f56b6ea2486cc14e585b55d1ba6 100644
--- a/app/observers/project_observer.rb
+++ b/app/observers/project_observer.rb
@@ -13,6 +13,12 @@ class ProjectObserver < BaseObserver
   def after_update(project)
     project.send_move_instructions if project.namespace_id_changed?
     project.rename_repo if project.path_changed?
+
+    GitlabShellWorker.perform_async(
+      :update_repository_head,
+      project.path_with_namespace,
+      project.default_branch
+    ) if project.default_branch_changed?
   end
 
   def before_destroy(project)
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index 991648f3f7989793d3ad6dd9a7680021a23d353d..8bced609e086cf50faeb97b04ebbf44a4070f109 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -36,6 +36,18 @@ module Gitlab
       system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git"
     end
 
+    # Update HEAD for repository
+    #
+    # path - project path with namespace
+    # branch - repository branch name
+    #
+    # Ex.
+    #  update_repository_head("gitlab/gitlab-ci", "3-1-stable")
+    #
+    def update_repository_head(path, branch)
+      system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch
+    end
+
     # Fork repository to new namespace
     #
     # path - project path with namespace