1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 22:02:09 +02:00
tldr/pages.zh/common/git-switch.md
Managor fe4c26ba2e
pages*/common/*: add option placeholders to translations part 2 (#15901)
Co-authored-by: Darío Hereñú <magallania@gmail.com>
2025-03-14 12:48:28 +05:30

744 B

git switch

切换 Git 分支。要求 Git 版本在 2.23 以上。 另请参阅 git checkout。 更多信息:https://git-scm.com/docs/git-switch.

  • 切换到一个已有的分支:

git switch {{分支名字}}

  • 创建并切换到一个新分支:

git switch {{[-c|--create]}} {{分支名字}}

  • 创建并切换到基于某个提交的新分支:

git switch {{[-c|--create]}} {{分支名字}} {{指定提交}}

  • 切换到之前的分支:

git switch -

  • 切换到一个分支,并更新所有匹配的子模块:

git switch --recurse-submodules {{分支名字}}

  • 切换到一个分支,并和当前分支以及暂未提交的修改进行三方合并:

git switch {{[-m|--merge]}} {{分支名字}}