1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-09 19:54:25 +00:00
gitea/templates/repo/issue/view_content/pull_merge_instruction.tmpl
Chris Copeland 47b5965862
Add merge style fast-forward-only (#28954)
With this option, it is possible to require a linear commit history with
the following benefits over the next best option `Rebase+fast-forward`:
The original commits continue existing, with the original signatures
continuing to stay valid instead of being rewritten, there is no merge
commit, and reverting commits becomes easier.

Closes #24906
2024-02-12 23:37:23 +01:00

50 lines
2.3 KiB
Handlebars

<div class="divider"></div>
<div class="instruct-toggle"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint" | Safe}} </div>
<div class="instruct-content gt-mt-3 gt-hidden">
<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}}<gitea-origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></gitea-origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div>
<div>git checkout {{$localBranch}}</div>
{{else}}
<div>git fetch -u origin {{.GetGitRefName}}:{{$localBranch}}</div>
{{end}}
</div>
{{if .ShowMergeInstructions}}
<div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}</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="gt-hidden" data-pull-merge-style="rebase">
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git merge --ff-only {{$localBranch}}</div>
</div>
<div class="gt-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="gt-hidden" data-pull-merge-style="squash">
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git merge --squash {{$localBranch}}</div>
</div>
<div class="gt-hidden" data-pull-merge-style="fast-forward-only">
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git merge --ff-only {{$localBranch}}</div>
</div>
<div class="gt-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}}
</div>