Hacker News new | ask | show | jobs
by _1tem 362 days ago
wait what? how do you work on multiple things at once with git worktrees?
2 comments

git worktree uses one repo to laid out multiple branches in separate directories.

git worktree add new/path/for/worktree branchname

I now refuse to use git checkout to switch branches, always keep my main branch checked out and updated and always use worktrees to work on features. Love this workflow!

I never had any reason to use it before claude code et al. So I also wasn’t aware

Commands for working with copies of your entire repo in a new folder on a new branch

https://git-scm.com/docs/git-worktree

This is amazing, I had no idea about this, I have been cloning my repo locally for years.