I have written an helper to help using this approach with worktree:
This works with Juju, but the tool is designed to be quite adaptable