I want to tell you about a tool I've been using for a few months now, that I can't believe that I ever went without. Recently, I've been more productive, experimental and I've learned more about my development environment just from using this tool.

Alright, I'm done burying the lead. The tool is git worktrees.

Worktrees is a feature built into git that allows you to have multiple working trees of a repository at once. That means you can have multiple branches checked out, with incomplete changes on each one. Instead of having one repository where your manipulation happens, you can have infinite copies (or, as many copies as you can hold on a hard drive)!

Often, I am in the middle of working on a feature and I get an email about an urgent bug or a small change that needs made immediately. Before, I would have to either create a "wip:" commit or stash my changes, and I don't really like doing either one of them. Now, as long as my files are saved, I can safely close my editor, create a new worktree and leave all of my uncomitted changes waiting for me to return.

How to set up your project for git worktrees