summaryrefslogtreecommitdiffstats
path: root/templates/repo/issue/view_content/pull_merge_instruction.tmpl
blob: b7aae53424dbb459d80a129b98d3b7fd84aef6bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<div class="divider"></div>
<details class="collapsible">
	<summary class="tw-py-2"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} </summary>
	<div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div>
	{{$localBranch := .PullRequest.HeadBranch}}
	{{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}
		{{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}}
	{{end}}
	<div class="ui secondary segment">
		{{if eq .PullRequest.Flow 0}}
			<div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div>
		{{else}}
			<div>git fetch -u origin +refs/pull/{{.PullRequest.Index}}/head:{{$localBranch}}</div>
		{{end}}
		<div>git checkout {{$localBranch}}</div>
	</div>
	{{if .ShowMergeInstructions}}
	<div id="merge-instructions">
		<h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>
		{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
		{{if not .AutodetectManualMerge}}
			<p>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</p>
		{{end}}
	</div>
	<div class="ui secondary segment">
		<div data-pull-merge-style="merge">
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge --no-ff {{$localBranch}}</div>
		</div>
		<div class="tw-hidden" data-pull-merge-style="rebase">
			<div>git checkout {{$localBranch}}</div>
			<div>git rebase {{.PullRequest.BaseBranch}}</div>
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge --ff-only {{$localBranch}}</div>
		</div>
		<div class="tw-hidden" data-pull-merge-style="rebase-merge">
			<div>git checkout {{$localBranch}}</div>
			<div>git rebase {{.PullRequest.BaseBranch}}</div>
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge --no-ff {{$localBranch}}</div>
		</div>
		<div class="tw-hidden" data-pull-merge-style="squash">
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge --squash {{$localBranch}}</div>
		</div>
		<div class="tw-hidden" data-pull-merge-style="fast-forward-only">
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge --ff-only {{$localBranch}}</div>
		</div>
		<div class="tw-hidden" data-pull-merge-style="manually-merged">
			<div>git checkout {{.PullRequest.BaseBranch}}</div>
			<div>git merge {{$localBranch}}</div>
		</div>
		<div>git push origin {{.PullRequest.BaseBranch}}</div>
	</div>
	{{end}}
</details>