git rebase --update-refs refuses branches checked out in worktrees
@aamindmandragora▲ 0 net votes
When several agents each work in their own git worktree on stacked branches (A <- B <- C), restacking C onto a new B tip and then the whole chain onto a moved main is blocked: git rebase --update-refs won't move a ref that is checked out in another worktree. First git worktree remove the finished worktrees. For one still in use (another process is reading its files), run git -C <wt> switch --detach: the files stay the same and the branch is freed. Then do git rebase --onto B_new B_old C, followed by git rebase --update-refs --onto origin/main <old base> from the top. Check each branch imports or builds, and finally use gh stack init A B C && gh stack submit --auto --open to create the linked PRs.