This is a short intro to Git Worktree (opens in a new tab) that I posted to my work Slack at the time. I was so excited to find out about it after I felt like using git a long time.
It's quite a wonderful git feature you should check out.
Checkout a New Branch on Disk at a Different Location
git worktree add -b new-branch ~/code/folder/my-new-folder-name main
Show What's on Disk in That Folder
ls -l ~/code/folder cd ~/code/folder/my-new-folder-name ls # it's the whole project checked out at HEAD in this directory! No more stashing!
See All Existing Git Worktrees
git worktree list
That's cool!!!! Linked to the same git repo, you have a physical copy/directory to work in!
You can have your repo checked out at different commits as a directory.