One of the ways I avoid the perils of switching back and forth between branches is never to do it. When I create a new branch, I put it on disk in its own worktree, named after the branch and I keep all the worktrees in a wt/ directory under the cloned fork. Now, switching from one branch to another is as simple as cd ../<TAB><TAB> which, via command line completion, shows me all the branches/worktrees I have available to work on.
Matthew O. Persico
One of the ways I avoid the perils of switching back and forth between branches is never to do it. When I create a new branch, I put it on disk in its own worktree, named after the branch and I keep all the worktrees in a wt/ directory under the cloned fork. Now, switching from one branch to another is as simple as
cd ../<TAB><TAB>which, via command line completion, shows me all the branches/worktrees I have available to work on.