Learned that you can work in two branches of the same local git repo at once without problems via the git worktree command.
Useful for if you want to quickly fix some code without having to faff around committing or stashing the stuff you were working on
git worktree add <path>
automatically creates a new branch whose name is the final component of<path>
, which is convenient if you plan to work on a new topic. For instance,git worktree add ../hotfix
creates new branch hotfix and checks it out at path../hotfix
. To instead work on an existing branch in a new worktree, usegit worktree add <path> <branch>
.