feat(ui): Suggest git switch instead of git checkout (#7385)

- A minor change that replaces the usages of `git checkout` to `git switch` in the UI. `git switch` is preferred over `git checkout` by git.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7385
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Lucas Grzegorczyk <furai@thd.vg>
Co-committed-by: Lucas Grzegorczyk <furai@thd.vg>
This commit is contained in:
Lucas Grzegorczyk 2025-03-30 11:37:15 +00:00 committed by Gusted
parent 63a80bf2b9
commit ba1e3405d6
2 changed files with 10 additions and 10 deletions

View file

@ -51,7 +51,7 @@
<div class="markup">
<pre><code>touch README.md
git init
{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}}
{{if ne .Repository.DefaultBranch "master"}}git switch -c {{.Repository.DefaultBranch}}{{end}}
git add README.md
git commit -m "first commit"
git remote add origin <span class="js-clone-url">{{$.CloneButtonOriginLink.HTTPS}}</span>

View file

@ -12,7 +12,7 @@
{{else}}
<div>git fetch -u origin +refs/pull/{{.PullRequest.Index}}/head:{{$localBranch}}</div>
{{end}}
<div>git checkout {{$localBranch}}</div>
<div>git switch {{$localBranch}}</div>
</div>
{{if .ShowMergeInstructions}}
<div id="merge-instructions">
@ -24,31 +24,31 @@
</div>
<div class="ui secondary segment">
<div data-pull-merge-style="merge">
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git switch {{.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 switch {{$localBranch}}</div>
<div>git rebase {{.PullRequest.BaseBranch}}</div>
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git switch {{.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 switch {{$localBranch}}</div>
<div>git rebase {{.PullRequest.BaseBranch}}</div>
<div>git checkout {{.PullRequest.BaseBranch}}</div>
<div>git switch {{.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 switch {{.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 switch {{.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 switch {{.PullRequest.BaseBranch}}</div>
<div>git merge {{$localBranch}}</div>
</div>
<div>git push origin {{.PullRequest.BaseBranch}}</div>