如何重命名 git 工作树

How can I rename a git worktree

鉴于我有 运行

$ git worktree add ~/worktrees/a
$ cd ~/worktrees/a
$ git status
On branch a

我想改为将工作树和分支的名称从 a 更改为 b

实现这一目标的一个选择(我最终做到了)是:

$ git worktree move ~/worktrees/a ~/worktrees/b
$ cd ~/worktrees/b
$ git branch -m b