You know that thing that you know you need to learn, that once you learn you’ll regret not having learned earlier?
That was git worktrees for me.
This is not intended to convince anyone to join the wagon.
I am writing this to serve as a reminder to myself and to have an easy place to go back to when I need to refresh on the basics. And here are the basics:
I tend to create the worktree directories at the same level as the directory where I keep the code (main), hence the code below uses a ../
to go one level up.
Here’s the basic commands:
git wortree add -b branch-name ../folder-name
git worktree remove ../folder-name
git worktree prune
—
That is it really.