pub fn repo_switch(
repo: &Repository,
remote_name: &str,
branch_name: &str,
force_checkout: bool,
) -> Result<(), Error>
Expand description
(强制)切换到远程分支(switch -f)
不会创建本地分支,HEAD将是分离的
缺点:
- 分离状态下
repo.head().name()
的值是“HEAD“,查询不到分支名 - 两个commit相同的远程分支之间无法切换