How do I manage multiple branches with git worktree in a git repository?
#12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When I'm switching between branches for development and reviews, I can get confused. Is there an easier way?
Git worktrees are great for this:
Assuming that the repository is at
<path>/main, do something like this:This puts a new directory next to
main, but it is a checkout of a new branch. In this way, each branch gets its own directory. Now, switching branches is a matter of switching directories.