https://docs.anthropic.com/en/docs/claude-code/common-workflows#run-parallel-claude-code-sessions-with-git-worktree
I discovered this incredibly useful Git worktree feature from Claude's development docs!
Git worktrees allow you to check out multiple branches from the same repository into separate directories. Each worktree has its own working directory with isolated files, while sharing the same Git history. Learn more in the official Git worktree documentation.
The Common Developer Dilemma
Picture this familiar scenario: You're working on branch A, editing a.txt
, when suddenly you get an urgent request to create a new branch B from main to fix b.txt
. Now you're stuck - what do you do with your unfinished changes on branch A?
Your usual instincts might be:
- commit - But your work isn't ready for a commit yet!
- stash - Too many commands to remember, and it's easy to get confused