diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl
index 42d9c82935..e89102802a 100644
--- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl
+++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl
@@ -8,11 +8,11 @@
{{end}}
{{if eq .PullRequest.Flow 0}}
-
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
-
git checkout {{$localBranch}}
+
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
{{else}}
-
git fetch -u origin {{.GetGitRefName}}:{{$localBranch}}
+
git fetch -u origin +refs/pull/{{.PullRequest.Index}}/head:{{$localBranch}}
{{end}}
+
git checkout {{$localBranch}}
{{if .ShowMergeInstructions}}
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}