From ba1e3405d66fa64dd4cfe14cfca283641b5b1216 Mon Sep 17 00:00:00 2001 From: Lucas Grzegorczyk Date: Sun, 30 Mar 2025 11:37:15 +0000 Subject: [PATCH] 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 Reviewed-by: Beowulf Co-authored-by: Lucas Grzegorczyk Co-committed-by: Lucas Grzegorczyk --- templates/repo/empty.tmpl | 2 +- .../view_content/pull_merge_instruction.tmpl | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index d3a81bc51d..2032b7e5d2 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -51,7 +51,7 @@
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 {{$.CloneButtonOriginLink.HTTPS}}
diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl
index b7aae53424..dd30a3a8d6 100644
--- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl
+++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl
@@ -12,7 +12,7 @@
 		{{else}}
 			
git fetch -u origin +refs/pull/{{.PullRequest.Index}}/head:{{$localBranch}}
{{end}} -
git checkout {{$localBranch}}
+
git switch {{$localBranch}}
{{if .ShowMergeInstructions}}
@@ -24,31 +24,31 @@
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge --no-ff {{$localBranch}}
-
git checkout {{$localBranch}}
+
git switch {{$localBranch}}
git rebase {{.PullRequest.BaseBranch}}
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge --ff-only {{$localBranch}}
-
git checkout {{$localBranch}}
+
git switch {{$localBranch}}
git rebase {{.PullRequest.BaseBranch}}
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge --no-ff {{$localBranch}}
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge --squash {{$localBranch}}
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge --ff-only {{$localBranch}}
-
git checkout {{.PullRequest.BaseBranch}}
+
git switch {{.PullRequest.BaseBranch}}
git merge {{$localBranch}}
git push origin {{.PullRequest.BaseBranch}}