diff --git a/app/models/issue.rb b/app/models/issue.rb
index 053387cffd70c74d7ba05be3c1898da91d60363a..5347d4fa1be68e9abc4a868fcbfe80c7f7fdfc9f 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -106,9 +106,8 @@ class Issue < ActiveRecord::Base
 
   def related_branches
     return [] if self.project.empty_repo?
-    self.project.repository.branch_names.select do |branch|
-      branch =~ /\A#{iid}-(?!\d+-stable)/i
-    end
+    
+    self.project.repository.branch_names.select { |branch| branch.end_with?("-#{iid}") }
   end
 
   # Reset issue events cache
@@ -139,7 +138,7 @@ class Issue < ActiveRecord::Base
   end
 
   def to_branch_name
-    "#{iid}-#{title.parameterize}"
+    "#{title.parameterize}-#{iid}"
   end
 
   def can_be_worked_on?(current_user)
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index fa34753c4fd2d3e4f5b4c2fe0a98d30438a1df9f..6e9152e444ec6eb1eeed939ed678ef8534cedbce 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -51,7 +51,7 @@ module MergeRequests
       # be interpreted as the use wants to close that issue on this project
       # Pattern example: 112-fix-mep-mep
       # Will lead to appending `Closes #112` to the description
-      if match = merge_request.source_branch.match(/\A(\d+)-/)
+      if match = merge_request.source_branch.match(/-(\d+)\z/)
         iid = match[1]
         closes_issue = "Closes ##{iid}"
 
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index f09b77c4a571611bf7200eed25920e3a96bda210..2afcaad4646346060a6c89b9070149738081c0de 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -210,7 +210,7 @@ class SystemNoteService
   # Called when a branch is created from the 'new branch' button on a issue
   # Example note text:
   #
-  #   "Started branch `201-issue-branch-button`"
+  #   "Started branch `issue-branch-button-201`"
   def self.new_issue_branch(issue, project, author, branch)
     h = Gitlab::Application.routes.url_helpers
     link = h.namespace_project_compare_url(project.namespace, project, from: project.default_branch, to: branch)
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 2ccdec1eeff6008309fb71d91e2bfddf0b32cde6..540a62eb1f84f6f0a53f4c8c98e865d6b5c17bb7 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -131,7 +131,7 @@ describe Issue, models: true do
   end
 
   describe '#related_branches' do
-    it "should " do
+    it "selects the right branches" do
       allow(subject.project.repository).to receive(:branch_names).
                                     and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name])
 
@@ -151,10 +151,10 @@ describe Issue, models: true do
   end
 
   describe "#to_branch_name" do
-    let(:issue) { build(:issue, title: 'a' * 30) }
+    let(:issue) { create(:issue, title: 'a' * 30) }
 
     it "starts with the issue iid" do
-      expect(issue.to_branch_name).to match /\A#{issue.iid}-a+\z/
+      expect(issue.to_branch_name).to match /-#{issue.iid}\z/
     end
   end
 end